Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding RabbitMQ scanning capability #90

Open
sw8y opened this issue Jan 27, 2020 · 1 comment
Open

Adding RabbitMQ scanning capability #90

sw8y opened this issue Jan 27, 2020 · 1 comment

Comments

@sw8y
Copy link

sw8y commented Jan 27, 2020

Hey folks - I'm trying to get the scanning functionality of ChangeMe expanded to include RabbitMQ. However, I'm running into an issue with the URL builder within the "targets.py" file. The RabbitMQ (or AMQP) URL is "amqp://username:password@localhost:15672/%2f". Currently, ChangeMe has URL building capabilities for MySQL, SNMP, and the normal IP:Port syntax. How can I use the below code for MySQL and modify it to place the username, password, and "/%2f" items into the targets.py file?

mysql://127.0.0.1:3306

protocol = target.split(':')[0]
host = target.split(':')[1].replace('//', '')
port = target.split(':')[2]
targets.add(Target(host=host, port=port, protocol=protocol))

@ztgrace
Copy link
Owner

ztgrace commented Mar 5, 2020

The real fix is to probably modify the code to use url parse: https://docs.python.org/3/library/urllib.parse.html

However, you could just create a new logic branch that accounts for the additional

if target.startswith('amqp'):
    s = "amqp://username:password@localhost:15672/%2f"
    match = re.match('^(?P<proto>amqp)://(?P<username>[a-zA-Z0-9]+):(?P<password>[a-zA-Z0-9]+)@(?P<host>[a-zA-Z0-9-\.]+):(?P<port>[0-9]+)(?P<path>.*)$', s)
    match.groupdict()
# {'username': 'username', 'proto': 'amqp', 'host': 'localhost', 'path': '/%2f', 'password': 'password', 'port': '15672'}
    match.group('username')
#'username'

Looking forward to the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants