Skip to content

Instantly share code, notes, and snippets.

@droberson
Created November 3, 2021 12:37
Show Gist options
  • Save droberson/f1283a8204aace067ae499ba38d053b6 to your computer and use it in GitHub Desktop.
Save droberson/f1283a8204aace067ae499ba38d053b6 to your computer and use it in GitHub Desktop.
ConnectBack shellcode configuration extractor
#!/usr/bin/env python3
# Extract IP address and port from "ConnectBack" shellcode used in Gitlab intrusions
# https://bazaar.abuse.ch/browse/tag/ConnectBack/
import sys
import struct
import socket
with open(sys.argv[1], "rb") as fp:
data = fp.read()
print("%s:%d" % (socket.inet_ntoa(struct.pack("<L", int.from_bytes(data[0xb2:0xb6], "little"))), socket.htons(int.from_bytes(data[0xb0:0xb2], "little"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment