Skip to content

Commit

Permalink
Merge pull request #17 from KathreftisAI/qa-release
Browse files Browse the repository at this point in the history
Qa release
  • Loading branch information
abhishekunotech authored Apr 18, 2024
2 parents a7487aa + 60b5245 commit 76b05e4
Show file tree
Hide file tree
Showing 44 changed files with 1,014,165 additions and 143 deletions.
664,012 changes: 664,012 additions & 0 deletions Bulk_Sync_Data.json

Large diffs are not rendered by default.

10,317 changes: 10,317 additions & 0 deletions Converter.syncDataForRecon.json

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# # Use the official Python image
# FROM python:3.10-slim

# # Set the working directory in the container
# WORKDIR /app

# # Copy the current directory contents into the container at /app
# COPY . /app

# # Install any needed packages specified in requirements.txt
# RUN pip install --no-cache-dir -r requirements.txt

# # Run break1.py when the container launches
# CMD ["python3", "./break1.py"]


# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app


ARG DEBIAN_FRONTEND="noninteractive"


RUN apt-get update \
&& apt-get install --yes --no-install-recommends \
gcc g++ libffi-dev

COPY requirements.txt /app/requirements.txt
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY . /app

# Make port 5000 available to the world outside this container
EXPOSE 5000

# Define environment variable
ENV NAME World


CMD ["gunicorn","-k","uvicorn.workers.UvicornWorker", "-w", "2", "--threads", "8","--timeout","300000", "-b", "0.0.0.0:5000", "modal2:app"]

# Run app.py when the container launches
#CMD ["uvicorn", "modal2:app", "--host", "0.0.0.0", "--port", "5000"]
100 changes: 100 additions & 0 deletions Only_in_Cymmetri_Dummy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[{{
"Target_logins": "test1",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test2",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test3",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test4",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test5",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test6",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test7",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test8",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test9",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test10",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
{
"Target_logins": "test69",
"batch_id": "f422d354-9a2f-4463-9031-e00f2394bab1",
"created": {
"$date": "2024-03-28T01:01:33.022Z"
},
"reconReportMetadataId": "6603f7002972066996c7f303",
"reconciliation_ids": "65fc04ae60643f5a285a06c6"
},
}]
Binary file added __pycache__/final1.cpython-310.pyc
Binary file not shown.
30 changes: 30 additions & 0 deletions app.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: []
INFO:root:Cymmetri Logins: []
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
INFO:root:Cymmetri Logins: ['74681', 'sahil123']
INFO:root:Cymmetri Logins: ['sahil123', '74681']
193 changes: 193 additions & 0 deletions backup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# from pymongo import MongoClient
# from datetime import datetime
# import redis
# import json
# from pymongo import MongoClient
# from datetime import datetime

# REDIS_HOST = '10.0.1.7'
# REDIS_PORT = 6379
# REDIS_USERNAME = 'infra'
# REDIS_PASSWORD = 'infra@123'
# REDIS_DATABASE = 1

# # Key for Redis hashmap
# redis_key = '65fc04ae60643f5a285a06c6'

# # Connect to Redis
# redis_client = redis.StrictRedis(host=REDIS_HOST,
# port=REDIS_PORT,
# username=REDIS_USERNAME,
# password=REDIS_PASSWORD,
# db=REDIS_DATABASE,
# decode_responses=True)

# # Fetch hash data from Redis
# redis_client = redis.StrictRedis(host=REDIS_HOST,
# port=REDIS_PORT,
# username=REDIS_USERNAME,
# password=REDIS_PASSWORD,
# db=REDIS_DATABASE,
# decode_responses=True)

# # Fetch string data from Redis
# string_data = redis_client.get(redis_key)

# # Convert the JSON-formatted string to a set
# if string_data:
# target_logins_list = json.loads(string_data)
# Target_logins = set(target_logins_list)
# #print("Target_logins",Target_logins)
# else:
# #print("No data found in Redis for the given key.")





# redis_key = 'cymmetri-datascience_sh_recon_65fc04ae60643f5a285a06c6_fdf52a93-17a3-4b3d-b2fb-b72df8db4fc6'

# # Connect to Redis
# redis_client = redis.StrictRedis(host=REDIS_HOST,
# port=REDIS_PORT,
# username=REDIS_USERNAME,
# password=REDIS_PASSWORD,
# db=REDIS_DATABASE,
# decode_responses=True)


# # Fetch hash data from Redis
# data = redis_client.hgetall(redis_key)
# #decoded_data = {key.decode(): value.decode() for key, value in data.items()}

# reconReportMetadataId = data.get('reconReportMetadataId')
# reconciliationId = data.get("reconciliationId")
# AppName = data.get("appName")
# appId = data.get("appId")
# batchId = data.get("batchId")




# # Extract required fields
# cymmetri_logins = json.loads(data.get("Cymmetri_logins", "[]"))
# Final_Overdue = json.loads(data.get("final_app_overdue", "[]"))

# # Convert final_app_overdue to set
# #final_app_overdue_set = {item["cymmetriLogin"] for item in final_app_overdue}

# #print("Cymmetri_logins:", cymmetri_logins)
# #print("Final App Overdue Set:", Final_Overdue)







# # # break_type_in_cymmetri_only = False
# # # break_type_in_target_only = False
# # # break_type_overdue = False

# # AppName = "Active Directory"
# # reconReportMetadataId = "65fc35eea58da1531da9f8a9"
# # appId = "653f482a0d2e4b5f289727ff"
# # reconciliationId = "65fc04ae60643f5a285a06c6"


# Cymmetri_Logins = set(cymmetri_logins)

# # # # Find common logins between Logins set and cymmetri_logins_set
# # # common_logins = Target_logins.intersection(cymmetri_logins_set)

# # # break_type_in_target_only = Target_logins - cymmetri_logins_set
# # # break_type_in_cymmetri_only = cymmetri_logins_set - Target_logins

# # # #print("break_type_in_target_only: ",break_type_in_target_only)
# # # #print("break_type_in_cymmetri_only: ",break_type_in_cymmetri_only)


# #find the app_overdue
# # app_overdue_logins_cymmetri = []
# # for item in Final_Overdue:
# # ##print("Cymmetri_Logins",item["cymmetriLogin"])
# # app_overdue_logins_cymmetri.append(item['cymmetriLogin'])

# # #print("app_overdue_logins_cymmetri",app_overdue_logins_cymmetri)

# # app_overdue_logins_target = []
# # for item in Final_Overdue:
# # ##print("App_Logins",item["appLogin"])
# # app_overdue_logins_target.append(item['appLogin'])

# # #print("app_overdue_logins_target",app_overdue_logins_target)

# # break_type_overdue = Target_logins.intersection(app_overdue_logins_cymmetri)
# # #print("break_type_overdue",break_type_overdue)




# # def find_break_types_and_insert(target_logins, cymmetri_logins, final_overdue):
# # # Find break_type_in_target_only
# # break_type_in_target_only = target_logins - set(cymmetri_logins)

# # # Find break_type_in_cymmetri_only
# # break_type_in_cymmetri_only = set(cymmetri_logins) - target_logins

# # # Find app_overdue_logins_cymmetri
# # app_overdue_logins_cymmetri = [item['cymmetriLogin'] for item in final_overdue]

# # # Find app_overdue_logins_target
# # app_overdue_logins_target = [item['appLogin'] for item in final_overdue]

# # # Find break_type_overdue
# # break_type_overdue = set(target_logins).intersection(app_overdue_logins_cymmetri)
# # #print("break_type_overdue",break_type_overdue)

# # # Connect to MongoDB
# # client = MongoClient("mongodb://unoadmin:[email protected]:27019,10.0.1.6:27020,10.0.1.6:27021/?authSource=admin&replicaSet=sso-rs&retryWrites=true&w=majority")
# # db = client["cymmetri-datascience"]
# # collection = db["shReconBreakRecords"]

# # # Insert records for break_type_in_target_only
# # for login in break_type_in_target_only:
# # record = {
# # "reconciliationId": reconciliationId,
# # "AppName": AppName,
# # "appId": appId,
# # "targetAppLogin": login,
# # "breakType": "present_in_target_only",
# # "performedAt": datetime.utcnow(),
# # "reconReportMetadataId": reconReportMetadataId
# # }
# # collection.insert_one(record)

# # # Insert records for break_type_in_cymmetri_only
# # # for login in break_type_in_cymmetri_only:
# # # record = {
# # # "reconciliationId": "65f16ea71eea4028c1fa4c32",
# # # "AppName": "Active Directory",
# # # "appId": "653f482a0d2e4b5f289727ff",
# # # "CymmetriAppLogin": login,
# # # "breakType": "break_type_in_cymmetri_only",
# # # "performedAt": datetime.utcnow(),
# # # "reconReportMetadataId": "65f416c178b1347f40aabbbd"
# # # }
# # # collection.insert_one(record)

# # # Insert records for break_type_overdue
# # for login in break_type_overdue:
# # record = {
# # "reconciliationId": reconciliationId,
# # "AppName": AppName,
# # "appId": appId,
# # "targetAppLogin": login,
# # "breakType": "app_overdue",
# # "performedAt": datetime.utcnow(),
# # "reconReportMetadataId": reconReportMetadataId
# # }
# # collection.insert_one(record)

# # # Call the function with the required inputs
# # find_break_types_and_insert(Target_logins, Cymmetri_Logins, Final_Overdue)
Loading

0 comments on commit 76b05e4

Please sign in to comment.