Example #1
0
def main():
    debug = 1
    term = "\n"

    if (debug == 1):
        print("in main()", end=term)

    zones_list = build_zone_list(term)

    ip1 = "146.18.2.137"  #input("enter source IP address : ")
    ip2 = "204.135.8.50"  #input("enter destination IP address : ")
    port = "443"  #input("enter port : ")

    hostinfo1 = hostinfo(ip1)
    hostinfo2 = hostinfo(ip2)
    policies = set()

    print("Zone Data for Source: ", end=term)
    hostinfo1 = build_hostinfo(hostinfo1, zones_list, term)
    print("Zone Data for Dest: ", end=term)
    hostinfo2 = build_hostinfo(hostinfo2, zones_list, term)
    print("**********************************", end=term)

    policies = policy_check(hostinfo1, hostinfo2, port, term)
    print("Policies to Search Against", end=term)
    print(policies, end=term)

    for policy in policies:
        print(policy, end=term)

        #need to add action accept check too
        """packet_mode_json = {
            "name" : policy,
            "filter" : "src:" + ip1 + " AND dst:" + ip2 + " AND svc:" + port,
            "filter-settings" : {
                "search-mode" : "packet"
            }
        }

        print(packet_mode_json)
        """
        if (debug == 1):
            print("creating packet search object", end=term)
        search = packetsearch(ip1, ip2, port, policy)

        search.create_json_string()
        print(search.get_json(), end=term)

        search.do_search()

        if (debug == 1):
            print("destroying packet search object", end=term)

    print("***** End of Program *****", end=term)
Example #2
0
import typogen
import hostinfo
from objtypo import objtypo
import safebrowsing
from whois import whois

print("[i] Running on : " + sys.platform)
if sys.platform.startswith('linux'):
    import syslog
    syslog.openlog(ident="TYPOFINDER",
                   logoption=syslog.LOG_PID,
                   facility=syslog.LOG_LOCAL0)
    syslog.syslog('Log processing initiated...')

_hostinfo = hostinfo.hostinfo()
_typogen = typogen.typogen()
KEY = ''


# v2 AJAX API
def resolve_www(sDomain, typo):
    # WWW
    try:
        www4results = _hostinfo.getWWW(sDomain)
        if www4results:
            for hostData in www4results:
                typo.wwwv4.append(hostData.address)
    except dns.resolver.NXDOMAIN:
        #No need to try IPv6 if this subdomain doesn't exist
        return
Example #3
0
import http.server
import urllib
import traceback
from os import curdir, sep
from socketserver import ThreadingMixIn
import json

import dns.resolver

import typogen
import hostinfo
from objtypo import objtypo
import safebrowsing
from whois import ourwhois

_hostinfo = hostinfo.hostinfo()
_typogen = typogen.typogen()
KEY = ''

# v2 AJAX API
def resolve_www(sDomain, typo):
    # WWW
    try:
        for hostData in _hostinfo.getWWW(sDomain):
            typo.wwwv4.append(hostData.address)
    except dns.resolver.NXDOMAIN:
        #No need to try IPv6 if this subdomain doesn't exist
        return
    except:
        pass
Example #4
0
def main():
    debug = 1
    term = "<br>"

    #create instance field storage
    form = cgi.FieldStorage()
    ip1 = form.getvalue('sourceip')
    ip2 = form.getvalue('destip')
    port = form.getvalue('service')

    ## html header and config data dump
    print("Content-type:text/html\r\n\r\n")
    print("<html>")
    print("<head>")
    print("<title>Rule Needed</title>")
    print("</head>")
    print("<body>")
    print("<br><br>")
    print("Needed Search 0.1<br><br>")

    print("----- Search Terms -----", end=term)
    print(ip1, end=term)
    print(ip2, end=term)
    print(port, end=term)
    print("--------------------", end=term)

    zones_list = build_zone_list(term)
    print("<br>")
    hostinfo1 = hostinfo(ip1)
    hostinfo2 = hostinfo(ip2)
    policies = set()

    print("Zone Data for Source: ", end=term)
    hostinfo1 = build_hostinfo(hostinfo1, zones_list, term)
    print("<br><br>")
    print("Zone Data for Dest: ", end=term)
    hostinfo2 = build_hostinfo(hostinfo2, zones_list, term)
    print("**********************************", end=term)

    policies = policy_check(hostinfo1, hostinfo2, port, term)
    print("Policies to Search Against", end=term)
    print(policies, end=term)

    print("---------------------------------------------------------------",
          end=term)
    for policy in policies:
        print(policy, end=term)

        if (debug == 1):
            print("creating packet search object", end=term)
        search = packetsearch(ip1, ip2, port, policy, term)

        search.create_json_string()
        print(search.get_json(), end=term)

        search.do_search()

        if (debug == 1):
            print("destroying packet search object", end=term)

    print("***** End of Program *****", end=term)
    print("<br><br>")
    print("</body>")
    print("</html>")