Python xss encryption script

Source: Internet
Author: User

 
After reading some information on the Internet, I found that it cannot be used. So I checked it online and changed the last line to use it.
'''
Python XSS payload encoder
Author: BGS (rstcenter.com)
Contributor cmiN (rstcenter.com)
Date: 13 August 2011
Version: Python 2.7
'''
#! /Usr/bin/env python
 
Import time
Import sys
Import urllib2
Import base64
 
Def main ():

Try:
If sys. argv [1] = "help ":
Print '[-]' + time. ctime ()
Print ''' [-] Instructions:
Encoder. py <encoding type> "<string>"
Available encodings: ascii b64 hex url
[-] Exiting...
'''
Elif sys. argv [1] = "b64 ":
B64_encode ()
Elif sys. argv [1] = "ascii ":
Ascii_encode ()
Elif sys. argv [1] = "hex ":
Hex_encode ()
Elif sys. argv [1] = "url ":
Url_encode ()

Else:
Sys. exit (1)
Except t Exception, e:
Print 'Type "encoder. py help" for instructions! '
Sys. exit (1)


Def b64_encode ():
Payload = sys. argv [2]
Encoded = base64.standard _ b64encode (payload)
Print '################## B64 String ################## #####'
Print''
Print 'string: '+ encoded
Print''
Print "#####################> EOF <############# ############"
 
Def ascii_encode ():
Payload = sys. argv [2]
String =''

For w in payload:
String + = str (ord (w) + ","
Print '################## ASCII String ################## ###'
Print''
Print 'string. fromCharCode ('+ string. strip (",") + ')'
Print''
Print "#####################> EOF <############# ############"
 
Def hex_encode ():
Payload = sys. argv [2]
Encoded = payload. encode ('hex ')
Print '################# HEX String www.2cto.com ################# ######'
Print''
Print 'string: '+ encoded
Print''
Print "#####################> EOF <############# ############"

Def url_encode ():
Payload = sys. argv [2]
Encoded = urllib2.quote (payload. encode ("utf8 "))
Print '################## URL String ################## #####'
Print''
Print 'string: '+ encoded
Print''
Print "#####################> EOF <############# ############"
 
If _ name _ = '_ main __':
Main ()
This article comes from the dedicated waiting blog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.