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

+ some outputs #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Flask, request, render_template
from flask import Flask, request, render_template, jsonify
from nimbusland import Nimbusland

app = Flask(__name__)
Expand All @@ -16,7 +16,10 @@ def nimbusland():
nl = Nimbusland()
ip_info = nl.get_aws_ip_info(target_ip)
ip_info = ip_info if ip_info else nl.get_azure_ip_info(target_ip)

if request.form['json']:
return jsonify({'result': ip_info})
if request.form['plain']:
return ip_info
except Exception as e:
error = True
error_message = str(e)
Expand Down
12 changes: 2 additions & 10 deletions nimbusland.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
#!/usr/bin/python

# --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- #

import requests
from netaddr import IPNetwork, IPAddress
import json
from xml.dom import minidom

# --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- #

__author__ = '@TweekFawkes'
__website__ = 'Stage2Sec.com'
__blog__ = 'https://Stage2Sec.com/blog/'

# --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- # --- #

'''

--- Nimbusland - AWS and Azure IP Check - Alpha v0.0.7 ---
Expand All @@ -23,6 +15,7 @@

'''


class Nimbusland:

def __init__(self):
Expand Down Expand Up @@ -55,5 +48,4 @@ def get_azure_ip_info(self, target_ip):
cidr = str(r.attributes['Subnet'].value)
if IPAddress(target_ip) in IPNetwork(cidr):
return [target_ip, cidr, str(region_name), 'Azure', "Microsoft"]

return False
return False