cavisson-pythonagent 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cavisson_pythonagent-0.0.1.dist-info/METADATA +32 -0
- cavisson_pythonagent-0.0.1.dist-info/RECORD +180 -0
- cavisson_pythonagent-0.0.1.dist-info/WHEEL +5 -0
- cavisson_pythonagent-0.0.1.dist-info/licenses/LICENSE +19 -0
- cavisson_pythonagent-0.0.1.dist-info/top_level.txt +1 -0
- pythonagent/__init__.py +22 -0
- pythonagent/agent/__init__.py +219 -0
- pythonagent/agent/internal/__init__.py +1 -0
- pythonagent/agent/internal/agent.py +1651 -0
- pythonagent/agent/internal/framesinfo.py +152 -0
- pythonagent/agent/internal/heap_dump.py +39 -0
- pythonagent/agent/internal/intercept_module.py +70 -0
- pythonagent/agent/internal/logs.py +122 -0
- pythonagent/agent/internal/metadata/__init__.py +0 -0
- pythonagent/agent/internal/metadata/agent_meta_data.py +276 -0
- pythonagent/agent/internal/proc_compat.py +75 -0
- pythonagent/agent/internal/profile.py +47 -0
- pythonagent/agent/internal/provider.py +83 -0
- pythonagent/agent/internal/thread_dump.py +85 -0
- pythonagent/agent/internal/udp.py +245 -0
- pythonagent/agent/internal/udp_message.py +800 -0
- pythonagent/agent/probes/Instrumentation/__init__.py +340 -0
- pythonagent/agent/probes/Instrumentation/find.py +243 -0
- pythonagent/agent/probes/Instrumentation/module_version_resolver.py +155 -0
- pythonagent/agent/probes/Instrumentation/new_parser.py +64 -0
- pythonagent/agent/probes/Instrumentation/parser.py +129 -0
- pythonagent/agent/probes/__init__.py +219 -0
- pythonagent/agent/probes/base.py +303 -0
- pythonagent/agent/probes/cache/__init__.py +51 -0
- pythonagent/agent/probes/cache/redis.py +119 -0
- pythonagent/agent/probes/cache/redis_asyncio.py +83 -0
- pythonagent/agent/probes/coroutines/__init__.py +1 -0
- pythonagent/agent/probes/coroutines/asyncio.py +63 -0
- pythonagent/agent/probes/elasticdb/__init__.py +7 -0
- pythonagent/agent/probes/elasticdb/aelastic.py +54 -0
- pythonagent/agent/probes/frameworks/__init__.py +27 -0
- pythonagent/agent/probes/frameworks/agentprofiler.py +105 -0
- pythonagent/agent/probes/frameworks/aiohttp_web.py +155 -0
- pythonagent/agent/probes/frameworks/aisess.py +151 -0
- pythonagent/agent/probes/frameworks/asgi.py +340 -0
- pythonagent/agent/probes/frameworks/bottle.py +27 -0
- pythonagent/agent/probes/frameworks/cherry.py +25 -0
- pythonagent/agent/probes/frameworks/django.py +128 -0
- pythonagent/agent/probes/frameworks/falcon.py +21 -0
- pythonagent/agent/probes/frameworks/fastapi.py +35 -0
- pythonagent/agent/probes/frameworks/flask.py +30 -0
- pythonagent/agent/probes/frameworks/pyramid.py +56 -0
- pythonagent/agent/probes/frameworks/test.py +108 -0
- pythonagent/agent/probes/frameworks/tornado_async_web.py +117 -0
- pythonagent/agent/probes/frameworks/tornado_web.py +133 -0
- pythonagent/agent/probes/frameworks/wsgi.py +353 -0
- pythonagent/agent/probes/grpc/__init__.py +76 -0
- pythonagent/agent/probes/grpc/client_interceptor.py +132 -0
- pythonagent/agent/probes/grpc/server_interceptor.py +129 -0
- pythonagent/agent/probes/havoc/__init__.py +0 -0
- pythonagent/agent/probes/havoc/custom_memory_stress.py +186 -0
- pythonagent/agent/probes/havoc/custom_thread_stress.py +187 -0
- pythonagent/agent/probes/havoc/havoc_constants.py +218 -0
- pythonagent/agent/probes/havoc/havoc_manager.py +981 -0
- pythonagent/agent/probes/http/__init__.py +49 -0
- pythonagent/agent/probes/http/aiohttp_client.py +59 -0
- pythonagent/agent/probes/http/boto.py +12 -0
- pythonagent/agent/probes/http/httplib.py +110 -0
- pythonagent/agent/probes/http/httpx_client.py +116 -0
- pythonagent/agent/probes/http/requests.py +15 -0
- pythonagent/agent/probes/http/tornado_httpclient.py +85 -0
- pythonagent/agent/probes/http/urllib3.py +16 -0
- pythonagent/agent/probes/langchain/__init__.py +21 -0
- pythonagent/agent/probes/langchain/base_tool.py +95 -0
- pythonagent/agent/probes/langchain/langchain_community.py +136 -0
- pythonagent/agent/probes/langchain/langchain_core.py +32 -0
- pythonagent/agent/probes/langchain/langchain_openai.py +110 -0
- pythonagent/agent/probes/logging/__init__.py +106 -0
- pythonagent/agent/probes/message_brokers/__init__.py +4 -0
- pythonagent/agent/probes/message_brokers/pika.py +126 -0
- pythonagent/agent/probes/mongodb/__init__.py +6 -0
- pythonagent/agent/probes/mongodb/pymongo.py +286 -0
- pythonagent/agent/probes/openai/__init__.py +3 -0
- pythonagent/agent/probes/openai/openai.py +797 -0
- pythonagent/agent/probes/span.py +101 -0
- pythonagent/agent/probes/sql/__init__.py +13 -0
- pythonagent/agent/probes/sql/botocores3.py +51 -0
- pythonagent/agent/probes/sql/dbapi.py +285 -0
- pythonagent/agent/probes/sql/dynamodb.py +90 -0
- pythonagent/agent/probes/sql/mysql_connector.py +24 -0
- pythonagent/agent/probes/sql/mysql_connector_cext.py +24 -0
- pythonagent/agent/probes/sql/mysqldb.py +43 -0
- pythonagent/agent/probes/sql/psycopg2.py +174 -0
- pythonagent/agent/probes/sql/pymysql.py +25 -0
- pythonagent/bootstrap/__init__.py +0 -0
- pythonagent/bootstrap/cav_gunicorn.py +26 -0
- pythonagent/bootstrap/cavagent_lambda_wrapper.py +291 -0
- pythonagent/bootstrap/run.py +47 -0
- pythonagent/bootstrap/sitecustomize.py +287 -0
- pythonagent/cavisson/netdiagnostics/CavAgent/instrumentationprofile.json +26 -0
- pythonagent/cavisson/netdiagnostics/CavAgent/interceptor_points.txt +29 -0
- pythonagent/cavisson/netdiagnostics/python/CavAgent/instrumentationprofile.json +42 -0
- pythonagent/cavisson/netdiagnostics/python/CavAgent/interceptor_points.txt +29 -0
- pythonagent/cavisson/netdiagnostics/python/config/ndsettings.conf +6 -0
- pythonagent/config.py +279 -0
- pythonagent/find.py +72 -0
- pythonagent/find_mod_cls_name.py +54 -0
- pythonagent/lang.py +131 -0
- pythonagent/lib.py +91 -0
- pythonagent/main/__init__.py +0 -0
- pythonagent/main/pytrace/__init__.py +79 -0
- pythonagent/main/pytrace/commands/__init__.py +0 -0
- pythonagent/main/pytrace/commands/auto_discovery.py +25 -0
- pythonagent/main/pytrace/commands/run.py +401 -0
- pythonagent/main/pytrace/pytrace.py +133 -0
- pythonagent/main/wsgi.py +6 -0
- pythonagent/main.py +27 -0
- pythonagent/run.py +46 -0
- pythonagent/sqins.py +8 -0
- pythonagent/test.py +73 -0
- pythonagent/utils.py +168 -0
- pythonagent/vendor/__init__.py +0 -0
- pythonagent/vendor/pympler/__init__.py +1 -0
- pythonagent/vendor/pympler/asizeof.py +2810 -0
- pythonagent/vendor/pympler/charts.py +62 -0
- pythonagent/vendor/pympler/classtracker.py +590 -0
- pythonagent/vendor/pympler/classtracker_stats.py +780 -0
- pythonagent/vendor/pympler/garbagegraph.py +80 -0
- pythonagent/vendor/pympler/mprofile.py +97 -0
- pythonagent/vendor/pympler/muppy.py +275 -0
- pythonagent/vendor/pympler/panels.py +115 -0
- pythonagent/vendor/pympler/process.py +238 -0
- pythonagent/vendor/pympler/py.typed +0 -0
- pythonagent/vendor/pympler/refbrowser.py +451 -0
- pythonagent/vendor/pympler/refgraph.py +350 -0
- pythonagent/vendor/pympler/summary.py +321 -0
- pythonagent/vendor/pympler/tracker.py +267 -0
- pythonagent/vendor/pympler/util/__init__.py +0 -0
- pythonagent/vendor/pympler/util/bottle.py +3809 -0
- pythonagent/vendor/pympler/util/compat.py +23 -0
- pythonagent/vendor/pympler/util/stringutils.py +77 -0
- pythonagent/vendor/pympler/web.py +346 -0
- pythonagent/vendor/werkzeug/__init__.py +20 -0
- pythonagent/vendor/werkzeug/_compat.py +228 -0
- pythonagent/vendor/werkzeug/_internal.py +473 -0
- pythonagent/vendor/werkzeug/_reloader.py +341 -0
- pythonagent/vendor/werkzeug/datastructures.py +3120 -0
- pythonagent/vendor/werkzeug/debug/__init__.py +498 -0
- pythonagent/vendor/werkzeug/debug/console.py +218 -0
- pythonagent/vendor/werkzeug/debug/repr.py +297 -0
- pythonagent/vendor/werkzeug/debug/tbtools.py +628 -0
- pythonagent/vendor/werkzeug/exceptions.py +829 -0
- pythonagent/vendor/werkzeug/filesystem.py +64 -0
- pythonagent/vendor/werkzeug/formparser.py +584 -0
- pythonagent/vendor/werkzeug/http.py +1307 -0
- pythonagent/vendor/werkzeug/local.py +420 -0
- pythonagent/vendor/werkzeug/middleware/__init__.py +25 -0
- pythonagent/vendor/werkzeug/middleware/dispatcher.py +66 -0
- pythonagent/vendor/werkzeug/middleware/http_proxy.py +219 -0
- pythonagent/vendor/werkzeug/middleware/lint.py +408 -0
- pythonagent/vendor/werkzeug/middleware/profiler.py +132 -0
- pythonagent/vendor/werkzeug/middleware/proxy_fix.py +169 -0
- pythonagent/vendor/werkzeug/middleware/shared_data.py +293 -0
- pythonagent/vendor/werkzeug/posixemulation.py +117 -0
- pythonagent/vendor/werkzeug/routing.py +2210 -0
- pythonagent/vendor/werkzeug/security.py +249 -0
- pythonagent/vendor/werkzeug/serving.py +1117 -0
- pythonagent/vendor/werkzeug/test.py +1123 -0
- pythonagent/vendor/werkzeug/testapp.py +241 -0
- pythonagent/vendor/werkzeug/urls.py +1138 -0
- pythonagent/vendor/werkzeug/useragents.py +202 -0
- pythonagent/vendor/werkzeug/utils.py +778 -0
- pythonagent/vendor/werkzeug/wrappers/__init__.py +36 -0
- pythonagent/vendor/werkzeug/wrappers/accept.py +50 -0
- pythonagent/vendor/werkzeug/wrappers/auth.py +33 -0
- pythonagent/vendor/werkzeug/wrappers/base_request.py +673 -0
- pythonagent/vendor/werkzeug/wrappers/base_response.py +700 -0
- pythonagent/vendor/werkzeug/wrappers/common_descriptors.py +341 -0
- pythonagent/vendor/werkzeug/wrappers/cors.py +100 -0
- pythonagent/vendor/werkzeug/wrappers/etag.py +304 -0
- pythonagent/vendor/werkzeug/wrappers/json.py +145 -0
- pythonagent/vendor/werkzeug/wrappers/request.py +49 -0
- pythonagent/vendor/werkzeug/wrappers/response.py +84 -0
- pythonagent/vendor/werkzeug/wrappers/user_agent.py +14 -0
- pythonagent/vendor/werkzeug/wsgi.py +1000 -0
pythonagent/test.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from pythonagent.agent.probes import frameworks, http, sql, logging, mongodb, cache, message_brokers, coroutines, openai, langchain, grpc as grpc_probe
|
|
4
|
+
|
|
5
|
+
BT = (
|
|
6
|
+
# Entry points
|
|
7
|
+
('flask', frameworks.intercept_flask),
|
|
8
|
+
('django.core.handlers.wsgi', frameworks.intercept_django_wsgi_handler),
|
|
9
|
+
('django.core.handlers.asgi', frameworks.intercept_django_asgi_handler),
|
|
10
|
+
('django.core.handlers.base', frameworks.intercept_django_base_handler),
|
|
11
|
+
('bottle', frameworks.intercept_bottle),
|
|
12
|
+
('aiohttp.web_app', frameworks.intercept_aiohttp_web),
|
|
13
|
+
('tornado.web', frameworks.intercept_tornado_async_web),
|
|
14
|
+
('cherrypy', frameworks.intercept_cherrypy),
|
|
15
|
+
('pyramid', frameworks.intercept_pyramid),
|
|
16
|
+
('falcon', frameworks.intercept_falcon),
|
|
17
|
+
('uvicorn.config', frameworks.intercept_uvicorn_config),
|
|
18
|
+
('starlette.routing', frameworks.intercept_fastapi_asgi_handler),
|
|
19
|
+
# HTTP exit calls
|
|
20
|
+
('httplib', http.intercept_httplib),
|
|
21
|
+
('http.client', http.intercept_httplib),
|
|
22
|
+
('urllib3', http.intercept_urllib3),
|
|
23
|
+
('requests', http.intercept_requests),
|
|
24
|
+
('tornado.httpclient', http.intercept_tornado_httpclient),
|
|
25
|
+
('aiohttp.client', http.intercept_aiohttp_client),
|
|
26
|
+
('httpx', http.intercept_httpx_client),
|
|
27
|
+
#('boto.https_connection', http.intercept_boto),
|
|
28
|
+
|
|
29
|
+
# gRPC client + server (single hook patches insecure_channel/secure_channel/server)
|
|
30
|
+
('grpc', grpc_probe.intercept_grpc),
|
|
31
|
+
|
|
32
|
+
# Logging
|
|
33
|
+
('logging', logging.intercept_logging),
|
|
34
|
+
|
|
35
|
+
# SQL exit calls
|
|
36
|
+
('psycopg2', sql.psycopg2.intercept_psycopg2_connection),
|
|
37
|
+
('pymysql.connections', sql.pymysql.intercept_pymysql_connections),
|
|
38
|
+
('mysql.connector.connection', sql.mysql_connector.intercept_mysql_connector_connection),
|
|
39
|
+
('mysql.connector.connection_cext', sql.mysql_connector_cext.intercept_mysql_connector_cext_connection),
|
|
40
|
+
('MySQLdb.connections', sql.mysqldb.intercept_MySQLdb_connection),
|
|
41
|
+
# MongoDB
|
|
42
|
+
('pymongo', mongodb.intercept_pymongo),
|
|
43
|
+
#Dynamo
|
|
44
|
+
('botocore.client', sql.dynamodb.intercept_dynamodb),
|
|
45
|
+
('botocore.endpoint', sql.botocores3.intercept_s3),
|
|
46
|
+
|
|
47
|
+
#REDIS
|
|
48
|
+
('redis.connection', cache.intercept_redis),
|
|
49
|
+
('redis.asyncio.connection', cache.intercept_redis_asyncio),
|
|
50
|
+
|
|
51
|
+
# RABBIT MQ
|
|
52
|
+
('pika', message_brokers.intercept_pika),
|
|
53
|
+
|
|
54
|
+
# Asyncio
|
|
55
|
+
('asyncio', coroutines.intercept_asyncio),
|
|
56
|
+
|
|
57
|
+
# OpenAI
|
|
58
|
+
('openai', openai.intercept_openai),
|
|
59
|
+
|
|
60
|
+
# LangChain
|
|
61
|
+
#('langchain_core.language_models', langchain.intercept_langchain_core_language_models),
|
|
62
|
+
#('langchain_core.runnables', langchain.intercept_langchain_core_runnables),
|
|
63
|
+
('langchain_core.tools', langchain.intercept_langchain_core_tools),
|
|
64
|
+
('langchain_community.vectorstores', langchain.intercept_langchain_community_vectorstores),
|
|
65
|
+
('langchain_community.embeddings', langchain.intercept_langchain_community_embeddings),
|
|
66
|
+
('langchain_openai', langchain.intercept_langchain_openai),
|
|
67
|
+
|
|
68
|
+
# LangGraph
|
|
69
|
+
#('langgraph.pregel', langchain.intercept_langgraph_pregel),
|
|
70
|
+
#('langgraph.utils.runnable', langchain.intercept_langgraph_utils_runnable),
|
|
71
|
+
|
|
72
|
+
)
|
|
73
|
+
|
pythonagent/utils.py
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import time
|
|
2
|
+
import sys
|
|
3
|
+
import random
|
|
4
|
+
import logging
|
|
5
|
+
import json
|
|
6
|
+
logger = logging.getLogger('pythonagent.agent')
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_current_timestamp_in_ms():
|
|
10
|
+
if sys.version_info >= (3, 7, 0):
|
|
11
|
+
time_stamp = time.time_ns() // 1000000
|
|
12
|
+
else:
|
|
13
|
+
time_stamp = int(round(time.time() * 1000))
|
|
14
|
+
|
|
15
|
+
return time_stamp
|
|
16
|
+
|
|
17
|
+
def get_current_timestamp_in_us():
|
|
18
|
+
if sys.version_info >= (3, 7, 0):
|
|
19
|
+
time_stamp = time.time_ns() // 1000
|
|
20
|
+
else:
|
|
21
|
+
time_stamp = int(round(time.time() * 1000000))
|
|
22
|
+
|
|
23
|
+
return time_stamp
|
|
24
|
+
|
|
25
|
+
def get_current_thread_time_in_us():
|
|
26
|
+
if sys.version_info >= (3, 7, 0):
|
|
27
|
+
time_stamp_cpu = time.thread_time_ns()
|
|
28
|
+
else:
|
|
29
|
+
time_stamp_cpu = int(time.thread_time() * 1000000000)
|
|
30
|
+
return time_stamp_cpu
|
|
31
|
+
|
|
32
|
+
def generate_flow_path_id():
|
|
33
|
+
# 63 bit number having 1 followed by 62 zeros
|
|
34
|
+
# In 64 bit long long, 1 bit is for sign (+ or -)
|
|
35
|
+
# So effective range is of 63 bits only
|
|
36
|
+
# Flow Path Id (63 bits) Format:
|
|
37
|
+
# DC Id (8 bits) App Id (10 bits) Timestamp ID (38 bits) Unique ID (7 bits)
|
|
38
|
+
|
|
39
|
+
flow_path_id = 0x4000000000000000
|
|
40
|
+
|
|
41
|
+
dc_id, dc_mask, dc_pos = 0, 0x0F, 56
|
|
42
|
+
app_id, app_mask, app_pos = 0, 0x03FF, 46
|
|
43
|
+
timestamp_id, timestamp_mask, timestamp_pos = get_current_timestamp_in_ms(), 0x3FFFFFFFFF, 8
|
|
44
|
+
unique_id, unique_mask, unique_pos = random.getrandbits(7), 0xFF, 0
|
|
45
|
+
|
|
46
|
+
dc_and = (dc_id & dc_mask) << dc_pos
|
|
47
|
+
app_and = (app_id & app_mask) << app_pos
|
|
48
|
+
timestamp_and = (timestamp_id & timestamp_mask) << timestamp_pos
|
|
49
|
+
unique_and = (unique_id & unique_mask) << unique_pos
|
|
50
|
+
|
|
51
|
+
flow_path_id = flow_path_id + dc_and + app_and + timestamp_and + unique_and
|
|
52
|
+
return flow_path_id
|
|
53
|
+
|
|
54
|
+
def generate_callout_id():
|
|
55
|
+
small_id_int = random.getrandbits(16)
|
|
56
|
+
return small_id_int
|
|
57
|
+
|
|
58
|
+
def get_utf8_bytes(str_obj):
|
|
59
|
+
if isinstance(str_obj, str):
|
|
60
|
+
bytes_obj = bytes(str_obj, 'utf-8')
|
|
61
|
+
else:
|
|
62
|
+
bytes_obj = bytes(str(str_obj), 'utf-8')
|
|
63
|
+
return bytes_obj
|
|
64
|
+
|
|
65
|
+
def build_host_name_str(host, port, callout_type, db, username):
|
|
66
|
+
return f"NA|{host}|{port}|NA|{callout_type}|{db}|NA|NA|NA|{username}|NA"
|
|
67
|
+
|
|
68
|
+
def split_fp_topo(fp_topo):
|
|
69
|
+
test_run, fpi, entry_fpi, nd_session_id, nv_session_id, page_id, full_fp = None, None, None, None, None, None, None
|
|
70
|
+
for part in fp_topo.strip('[]').split(']['):
|
|
71
|
+
if part.startswith("FP:"):
|
|
72
|
+
part = part.strip()[3:-1]
|
|
73
|
+
test_run, fpi, entry_fpi, nd_session_id, nv_session_id, page_id = part.split(':')
|
|
74
|
+
full_fp = part
|
|
75
|
+
return test_run, fpi, entry_fpi, nd_session_id, nv_session_id, page_id, full_fp
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def get_true_false(val):
|
|
79
|
+
val = int(val)
|
|
80
|
+
if val == 1:
|
|
81
|
+
return True
|
|
82
|
+
if val == 0:
|
|
83
|
+
return False
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def get_validated_duration(start_time, end_time, callout_type):
|
|
87
|
+
if start_time <= 0:
|
|
88
|
+
duration = 0
|
|
89
|
+
logger.error("{} callout duration set to 0 because received start_time is {}".format(callout_type, start_time))
|
|
90
|
+
else:
|
|
91
|
+
duration = end_time - start_time
|
|
92
|
+
if duration < 0:
|
|
93
|
+
duration = 0
|
|
94
|
+
logger.error("{} callout duration set to 0 because calculated duration is {} start_time {} end_time {}".format(callout_type, duration, start_time, end_time))
|
|
95
|
+
return duration
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def process_raw_havoc_message(output, mode="NATIVE"):
|
|
99
|
+
|
|
100
|
+
if mode == "AWS_LAMBDA":
|
|
101
|
+
output = output[2:-1] # Remove b' from beginning and ' from end
|
|
102
|
+
split_arr = output.split("\\n", 1)
|
|
103
|
+
else:
|
|
104
|
+
split_arr = output.split("\n", 1)
|
|
105
|
+
|
|
106
|
+
header = split_arr[0]
|
|
107
|
+
body = split_arr[1]
|
|
108
|
+
body = body.replace("-", ":")
|
|
109
|
+
|
|
110
|
+
if mode == "AWS_LAMBDA":
|
|
111
|
+
body = body.replace("\\n", "")
|
|
112
|
+
else:
|
|
113
|
+
body = body.replace("\n", "")
|
|
114
|
+
|
|
115
|
+
body_json = json.loads(body)
|
|
116
|
+
body_json["havocType"] = int(body_json["havocType"])
|
|
117
|
+
body = json.dumps(body_json)
|
|
118
|
+
header = header[:-1] # Trim ; from end
|
|
119
|
+
header_dict = {}
|
|
120
|
+
|
|
121
|
+
header_split = header.split(";")
|
|
122
|
+
|
|
123
|
+
count = 0
|
|
124
|
+
for element in header_split:
|
|
125
|
+
if count == 0:
|
|
126
|
+
count += 1
|
|
127
|
+
continue # Ignore first value: NetDiagnosticMessage2.0
|
|
128
|
+
else:
|
|
129
|
+
element_split = element.split(":")
|
|
130
|
+
key = element_split[0].strip()
|
|
131
|
+
value = element_split[1].strip()
|
|
132
|
+
header_dict[key] = value
|
|
133
|
+
count += 1
|
|
134
|
+
|
|
135
|
+
return body, header_dict
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def process_udp_agent_init_response(output, agent_obj):
|
|
139
|
+
output = output[3:-2] # Remove b'[ from beginning and ]' from end
|
|
140
|
+
output = output.replace("\\n", "")
|
|
141
|
+
output_split = output.split("},") # Separate individual fields
|
|
142
|
+
|
|
143
|
+
for item in output_split:
|
|
144
|
+
item = item + "}"
|
|
145
|
+
key_val = item.split(", {")
|
|
146
|
+
key = key_val[0].strip()[1:-1]
|
|
147
|
+
val = "{" + key_val[1]
|
|
148
|
+
|
|
149
|
+
if key == "AppId":
|
|
150
|
+
val_json = json.loads(val)
|
|
151
|
+
app_id = val_json["id"]
|
|
152
|
+
agent_obj.app_id = app_id
|
|
153
|
+
|
|
154
|
+
def parse_headers(input_list, key_val_sep, item_value_sep):
|
|
155
|
+
output_str = ""
|
|
156
|
+
if input_list:
|
|
157
|
+
for key, value in input_list:
|
|
158
|
+
key = key.decode()
|
|
159
|
+
value = value.decode()
|
|
160
|
+
value = value.replace("|", "%7C") # CavSF has | in value
|
|
161
|
+
value = value.replace(":", "%3A") # Host as : in value
|
|
162
|
+
value = value.replace("=", "%3D") # Accept, Accept-Language, and ND-NV cookies have = in value
|
|
163
|
+
new_str = key + key_val_sep + value + item_value_sep
|
|
164
|
+
output_str += new_str
|
|
165
|
+
output_str = output_str[:-1] # Remove last |
|
|
166
|
+
# output_str = output_str.replace("&", "|")
|
|
167
|
+
return output_str
|
|
168
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.1'
|