Last active
March 15, 2018 18:35
-
-
Save pasknel/1237fcfc1923da0cf2b0b37bd8f09a56 to your computer and use it in GitHub Desktop.
PoC script to grab the implementation version from a PACS server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynetdicom3 import AE | |
from pynetdicom3 import QueryRetrieveSOPClassList | |
from pynetdicom3.pdu_primitives import ImplementationVersionNameNotification | |
def handle_association(response): | |
print("[+] Association Established!") | |
scp_ae_title = response.responding_ae_title.strip() | |
for element in response.user_information: | |
if type(element) == ImplementationVersionNameNotification: | |
version_name = element.implementation_version_name | |
print "[*] AE Title: %s - Implementation Version: %s" % (scp_ae_title, version_name) | |
ae = AE(scu_sop_class = QueryRetrieveSOPClassList) | |
ae.on_association_accepted = handle_association | |
ip = "IP ADDRESS HERE" | |
port = 104 | |
try: | |
print "[*] Trying to connect to %s" % ip | |
association = ae.associate(ip, port) | |
if association.is_established: | |
association.release() | |
except Exception as ex: | |
print ex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment