Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5928941
migrate and fix rednering issues of diag_render_login_screen.py
randomstr1ng May 19, 2026
31976f6
adjust diag_capturer.py for python3 compatibility
randomstr1ng May 19, 2026
f6f95da
migrate diag_login_sreen_info.py; fix related issues with the SAPRout…
randomstr1ng May 19, 2026
4a288b2
add default credentiasl for SAP ABAP Cloud Developer Trial Images
randomstr1ng May 19, 2026
6c7252a
fix port int<>str handling
randomstr1ng May 19, 2026
5dfa6d3
fix an issue with input file handling when only 2 instead of 3 parts …
randomstr1ng May 19, 2026
4ed8fb2
fix to print entered data and properly close connection. cleanup coding.
randomstr1ng May 19, 2026
f31b9c8
fix output formatting
randomstr1ng May 19, 2026
2f439e7
fix output formatting & sap router route handling
randomstr1ng Jun 2, 2026
93e108f
ms_monitor: fix formatting isssues & output parsing
randomstr1ng Jun 2, 2026
3d9b6e3
ms_change_param: fix output bytes -> str
randomstr1ng Jun 4, 2026
f38ced3
adjust output from b"" -> string
randomstr1ng Jun 4, 2026
9de36aa
fix ADM parsing issue
randomstr1ng Jun 4, 2026
b3b49f2
fix proper field parsing; add proper output for ms_observer; add clea…
randomstr1ng Jun 4, 2026
21f020f
Merge branch 'master' into migrate-example-scripts
randomstr1ng Jun 4, 2026
da63592
fix encoding to bytes
randomstr1ng Jun 4, 2026
2cb515c
Merge branch 'migrate-example-scripts' of github.com:randomstr1ng/pys…
randomstr1ng Jun 4, 2026
dc9ca4b
bugfixes for router_portfwd after python3 migration
randomstr1ng Jun 5, 2026
ae5aeef
adjust encoding (b-> str); switch to python native perf counter to re…
randomstr1ng Jun 5, 2026
075888c
bugfix output encoding
randomstr1ng Jun 5, 2026
cbd2fdb
fix error handlich router_niping
randomstr1ng Jun 5, 2026
3dcb0a9
fix output error and json format handling
randomstr1ng Jun 5, 2026
63ee34a
fix request format handling.
randomstr1ng Jun 6, 2026
11eb66b
fix output extraction and formatting.
randomstr1ng Jun 6, 2026
d1f06c6
bugfix formatting and extraction issues
randomstr1ng Jun 6, 2026
5972929
add connection error handling + encode xml to avoid scapy error
randomstr1ng Jun 6, 2026
0ec18fd
update sapigs_test to handle the request bytes conversion properly
randomstr1ng Jun 6, 2026
e711ba0
fix output encoding; adjust defaults; tweak error handling
randomstr1ng Jun 6, 2026
97ef3b5
fix output encoding; adjust defaults; tweak error handling
randomstr1ng Jun 6, 2026
c3a0619
fix str encoding of raw bytes.
randomstr1ng Jun 6, 2026
e42eb79
fix json parsing issue
randomstr1ng Jun 6, 2026
b25e010
fix byte/str encoding issues
randomstr1ng Jun 6, 2026
91ecb9a
fix signed int error, fix encodig (str/bytes) issues
randomstr1ng Jun 7, 2026
d826e13
Fix Python 3 migration edge cases
martingalloar Jul 1, 2026
ee9df80
Fix CI packet and keepalive regressions
martingalloar Jul 1, 2026
c933f6d
Add field byte handling regression tests
martingalloar Jul 1, 2026
a8e27bc
Revert "Add field byte handling regression tests"
martingalloar Jul 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
.venv
build/
develop-eggs/
dist/
Expand Down
18 changes: 18 additions & 0 deletions examples/default_sap_credentials
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ SAP*:Down1oad:000,001
DEVELOPER:Down1oad:001
BWDEVELOPER:Down1oad:001

# SAP ABAP Cloud Developer Trial
# 2023
DDIC:ABAPtr2023#00:000,001
SAP*:ABAPtr2023#00:000,001
DEVELOPER:ABAPtr2023#00:000,001
# 2022 SP1
DDIC:ABAPtr2022#01:000,001
SAP*:ABAPtr2022#01:000,001
DEVELOPER:ABAPtr2022#01:000,001
# 2022
DDIC:ABAPtr2022#00:000,001
SAP*:ABAPtr2022#00:000,001
DEVELOPER:ABAPtr2022#00:000,001
# 1909 SP1
DDIC:Ldtf5432:000,001
SAP*:Ldtf5432:000,001
DEVELOPER:Ldtf5432:000,001

# SAP CA Introscope Enterprise Manager
# cemadmin password hash acef2c15bcd349db90dffece73e1256e881c4416fc1f2d3a4946418349d9a
cemadmin:quality
Expand Down
8 changes: 5 additions & 3 deletions examples/diag_capturer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ def parse_packet(self, pkt):
if key not in self.packets_metadata:
self.packets_metadata[key] = []
self.packets_metadata[key].append((pkt[TCP].seq + pkt[TCP].ack,
str(pkt[Raw].load)))
bytes(pkt[Raw].load)))

def reassemble(self):
# Build a stream of packets for each connection
streams = {}
for key, value in list(self.packets_metadata.items()):
value.sort()
value = list(value for value, _ in itertools.groupby(value))
streams[key] = ''
streams[key] = b''
for pkts in sorted(value):
streams[key] += pkts[1]

Expand Down Expand Up @@ -105,8 +105,10 @@ def parse_fields(self, pkt):
for atom in [atom for atom_item in atoms for atom in atom_item.item_value.items]:
if atom.etype in [121, 122, 123, 130, 131, 132]:
text = atom.field1_text or atom.field2_text
if isinstance(text, bytes):
text = text.decode("utf-8", errors="replace")
text = text.strip()
if "@\Q" in text:
if "@\\Q" in text:
parts = text.split("@")
try:
text = "%s (hint: %s)" % (parts[2], parts[1])
Expand Down
4 changes: 3 additions & 1 deletion examples/diag_interceptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def filter_client(packet):
print("[*] Input fields:")
for atom in [atom for atom_item in atoms for atom in atom_item.item_value.items]:
if atom.etype in [121, 122, 123, 130, 131, 132]:
text = atom.field1_text or atom.field2_text
text = atom.field1_text if atom.field1_text else atom.field2_text
if isinstance(text, bytes):
text = text.decode("utf-8", errors="replace")
text = text.strip()
if atom.attr_DIAG_BSD_INVISIBLE and len(text) > 0:
# If the invisible flag was set, we're probably
Expand Down
10 changes: 7 additions & 3 deletions examples/diag_login_brute_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,15 @@ def main():
if len(line) == 0 or line.startswith("#"):
continue

(username, password, clients) = line.split(':')
if clients == "*":
parts = line.split(':', 2)
if len(parts) == 2:
username, password = parts
clients = client_list
elif len(parts) == 3:
username, password, client_field = parts
clients = client_list if client_field == "*" else client_field.split(',')
else:
clients = clients.split(',')
raise ValueError("Invalid line: %s" % line)

for client in clients:
testcases.append((username, password, client))
Expand Down
8 changes: 6 additions & 2 deletions examples/diag_login_screen_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,14 @@ def show_text_info(item):
for it in items:
var = it.getfieldval('name_text')
value = it.getfieldval("field1_text")
if value is None:
if not value:
value = it.getfieldval("field2_text")
if isinstance(var, bytes):
var = var.decode("utf-8", errors="replace")
if isinstance(value, bytes):
value = value.decode("utf-8", errors="replace")
key = '%s_%s' % (it.row, it.col)
if key not in dico.keys():
if key not in dico:
dico[key] = {'var': key, 'value': value}
if value:
dico[key]['value'] = value.strip()
Expand Down
Loading
Loading