コード例 #1
0
    def check_for_old_session(self):

        print("Checking for Older Spider Sessions")
        sleep(3)

        import socket
        ip = socket.gethostbyname(self.origin["netloc"])
        print("[ IP ]:  {}".format(ip))

        # save IP of this URL to Data Object
        self.data.target_ip = ip

        sleep(3)

        from Plugins.IPConversion.controller import ip_to_int
        as_int = ip_to_int(socket.gethostbyname(self.origin["netloc"]))
        print(as_int)

        sleep(3)

        sess_path = "Sessions/Crawler/"

        # Is there a archived session of this IP?
        archive_file = os.path.isfile("{}{}.txt".format(
            sess_path, str(as_int)))
        # print(archive_file)
        sleep(3)

        if archive_file:
            with open("{}{}.txt".format(sess_path, str(as_int)),
                      mode="r") as archive:
                for e, link in enumerate(archive.readlines()):
                    # print(str("[ {}   ] - {}".format(e, link)).strip())
                    self.hrefs_all.append(link)

            print(len(self.hrefs_all))
            sleep(3)

        else:
            print("None Archive Session Found")
コード例 #2
0
    def __init__(self, name=None, ip=None, url=None, dns=None, contract=None, pinned=None, note=None):
        import datetime
        super()
        self._id = id(self)

        self.target_id = "decimal(ip)"
        self.target_name = name
        self.target_ip = ip
        self.target_url = url
        self.target_contract = contract
        self.target_dns = dns
        self.target_note = note
        self.target_contract = contract # Temp
        self.target_pinned = pinned

        self.session_id = "ip + date + time"
        self.session_start = str(datetime.datetime.now())

        if self.target_ip is not None:
            from Plugins.IPConversion import controller
            self.target_id = controller.ip_to_int(self.target_ip)
            del controller
コード例 #3
0
ファイル: spider.py プロジェクト: Goku0858756/NimbusFramework
    def check_for_old_session(self):

        print("Checking for Older Spider Sessions")
        sleep(3)

        import socket
        ip = socket.gethostbyname(self.origin["netloc"])
        print("[ IP ]:  {}".format(ip))

        # save IP of this URL to Data Object
        self.data.target_ip = ip

        sleep(3)

        from Plugins.IPConversion.controller import ip_to_int
        as_int = ip_to_int(socket.gethostbyname(self.origin["netloc"]))
        print(as_int)

        sleep(3)

        sess_path = "Sessions/Crawler/"

        # Is there a archived session of this IP?
        archive_file = os.path.isfile("{}{}.txt".format(sess_path, str(as_int)))
        # print(archive_file)
        sleep(3)

        if archive_file:
            with open("{}{}.txt".format(sess_path, str(as_int)), mode="r") as archive:
                for e, link in enumerate(archive.readlines()):
                    # print(str("[ {}   ] - {}".format(e, link)).strip())
                    self.hrefs_all.append(link)

            print(len(self.hrefs_all))
            sleep(3)

        else:
            print("None Archive Session Found")
コード例 #4
0
__author__ = 'N05F3R4TU'
import requests



# re = requests.get("")

from Plugins.IPConversion import controller

print(controller.ip_to_int("66.155.40.249"))
コード例 #5
0
 def convert_ip_to_decimal(self, ip):
     from Plugins.IPConversion.controller import ip_to_int
     dec = ip_to_int(ip=ip)
     return dec