spammimic.py

SPAM!
I wrote a new python tool that encode/decode spam messages, it operates
and does it job from the website. I wrote this tool so you
can do your spam messages from the command-line.
Explanation of SpamMIMIC :
There are terrific tools (like and ) for encrypting your mail. If somebody along the way looks at the mail they can’t understand it. But they do know you are sending encrypted mail to your pal.
The answer: encode your message into something innocent looking.
Your messages will be safe and nobody will know they’re encrypted!
Sourcecode :
#!/usr/bin/env python import sys import urllib from types import * try: from BeautifulSoup import BeautifulSoup except: print "[-] Unable to import BeautifulSoup, You can download it from." print " http://www.crummy.com/software/BeautifulSoup/" sys.exit(1) def banner(): print "##########################" print "## Spammimic v0.1 ##" print "## qnix[at]0x80[dot]org ##" print "##########################\n" def error(msg, exitcode): print "%s" % msg if exitcode == 1: sys.exit(1) elif exitcode == 0: pass def main(): banner() print "1: encode" print "2: decode" print "3: explanation" print "4: exit" print '->', try: option = eval(raw_input()) except: print "[-] Err: Wrong input" sys.exit(1) if option == 1: encode_menu() elif option == 2: decode_menu() elif option == 3: explanation() elif option == 4: sys.exit(0) else: print "[-] Err: Invalid input" sys.exit(1) def explanation(): print """ This tool works via SpamMIMIC service, for more information visit their website http://spammimic.com There are terrific tools (like PGP and GPG) for encrypting your mail. If somebody along the way looks at the mail they can't understand it. But they do know you are sending encrypted mail to your pal. The answer: encode your message into something innocent looking. Your messages will be safe and nobody will know they're encrypted! There is tons of spam flying around the Internet. Most people can't delete it fast enough. It's virtually invisible. This site gives you access to a program that will encrypt a short message into spam. Basically, the sentences it outputs vary depending on the message you are encoding. Real spam is so stupidly written it's sometimes hard to tell the machine written spam from the genuine article. """ main() def encode_menu(): print "************" print "** Encode **" print "************\n" print "1: Encode with out password" print "2: Encode with password" print "3: Encode as fake PGP" print "4: Encode as space" print "5: Go back.." print "\n->", try: type = eval(raw_input()) except: error("[-] Err: Invalid option", 1) encode(type) def decode_menu(): print "************" print "** Decode **" print "************\n" print "1: Decode with out password" print "2: Decode with password" print "3: Decode as fake PGP" print "4: Decode space" print "5: Go back.." print "\n->", try: type = eval(raw_input()) except: error("[-] Err: Invalid option", 1) decode(type) def read(fin): content = "" try: for lines in open(fin, 'r').readlines(): content += lines except: error("Couldn't open \"%s\"" % fin, 1) return content def encode(type): if type == 1: print "*****************************" print "** Encode without password **" print "*****************************\n" print "Input :", fin = raw_input() print "Output :", fout = raw_input() spammimic("encode_no_password", read(fin), fout, 0, 0) elif type == 2: print "**************************" print "** Encode with password **" print "**************************\n" print "Input :", fin = raw_input() print "Output :", fout = raw_input() print "Passwd :", passwd = raw_input() spammimic("encode_with_password", read(fin), fout, passwd, 0) elif type == 3: print "************************" print "** Encode as fake PGP **" print "************************\n" print "Input :", fin = raw_input() print "Output :", fout = raw_input() spammimic("encode_PGP", read(fin), fout, 0, 0) elif type == 4: print "*********************" print "** Encode as space **" print "*********************\n" print "Input :", fin = raw_input() print "Innocent looking textfile :", innocent = raw_input() print "Output :", fout = raw_input() spammimic("encode_space", read(fin), fout, 0, read(innocent)) elif type == 5: main() else: print "Err: Invalid option" sys.exit(1) def decode(type): if type == 1: print "*****************************" print "** Decode without password **" print "*****************************\n" print "Input :", fin = raw_input() print "Output :", fout = raw_input() spammimic("decode_no_password", read(fin), fout, 0, 0) elif type == 2: print "**************************" print "** Decode with password **" print "**************************\n" print "Input :", fin = raw_input() print "Output :", fout = raw_input() print "Passwd :", passwd = raw_input() spammimic("decode_with_password", read(fin), fout, passwd, 0) elif type == 3: print "************************" print "** Decode as fake PGP **" print "************************\n" print "Input :", fin = raw_input() print "Output :", fout = raw_input() spammimic("decode_PGP", read(fin), fout, 0, 0) elif type == 4: print "*********************" print "** Decode as space **" print "*********************\n" print "Input :", fin = raw_input() print "Output :", fout = raw_input() spammimic("decode_space", read(fin), fout, 0, 0) elif type == 5: main() else: print "Err: Invalid option" sys.exit(1) def spammimic(option, string, output, password, innocent): if option == "encode_no_password": params = {} params['plaintext'] = string; params = urllib.urlencode(params) try: f = urllib.urlopen("http://spammimic.com/encode.cgi?%s" % params) except: error("Couldn't connect to spammimic.com", 1) content = f.read() soup = BeautifulSoup(''.join(content)) data = soup.textarea.string try : fd = open(output, 'w') fd.write(data) fd.close() except: error("Couldn't write to \"%s\"" % output, 1) elif option == "decode_no_password": params = {} params['cyphertext'] = string; params = urllib.urlencode(params) try : f = urllib.urlopen("http://spammimic.com/decode.cgi?%s" % params) except: error("Couldn't connect to spammimic.com", 1) content = f.read() soup = BeautifulSoup(''.join(content)) data = soup.findAll('input')[1]['value'] try : fd = open(output, 'w') fd.write(data) fd.close() except: error("Couldn't write to \"%s\"" % output, 1) elif option == "encode_with_password": params = {} params['password'] = password; params['plaintext'] = string; params = urllib.urlencode(params) try : f = urllib.urlopen("http://spammimic.com/encode.cgi?%s" % params) except: error("Couldn't connect to spammimic.com", 1) content = f.read() soup = BeautifulSoup(''.join(content)) data = soup.textarea.string try: fd = open(output, 'w') fd.write(data) fd.close() except: error("Couldn't write to \"%s\"" % output, 1) elif option == "decode_with_password": params = {} params['password'] = password; params['cyphertext'] = string; params = urllib.urlencode(params) try: f = urllib.urlopen("http://spammimic.com/decode.cgi?%s" % params) except: error("Couldn't connect to spammimic.com", 1) content = f.read() soup = BeautifulSoup(''.join(content)) data = soup.findAll('input')[1]['value'] try: fd = open(output, 'w') fd.write(data) fd.close() except: error("Couldn't write to \"%s\"" % output, 1) elif option == "encode_PGP": params = {} params['plaintext'] = string; params = urllib.urlencode(params) try: f = urllib.urlopen("http://spammimic.com/encodepgp.cgi?%s" % params) except: error("Couldn't connect to spammimic.com", 1) content = f.read() soup = BeautifulSoup(''.join(content)) data = soup.textarea.string try: fd = open(output, 'w') fd.write(data[1:]) fd.close() except: error("Couldn't write to \"%s\"" % output, 1) elif option == "decode_PGP": params = {} params['cyphertext'] = string; params = urllib.urlencode(params) try: f = urllib.urlopen("http://spammimic.com/decodepgp.cgi?%s" % params) except: error("Couldn't connect to spammimic.com", 1) content = f.read() soup = BeautifulSoup(''.join(content)) data = soup.textarea.string try: fd = open(output, 'w') fd.write(data) fd.close() except: error("Couldn't write to \"%s\"" % output, 1) elif option == "encode_space": params = {} params['plaintext'] = string; params['spacetext'] = innocent; params = urllib.urlencode(params) try: f = urllib.urlopen("http://spammimic.com/encodespace.cgi?%s" % params) except: error("Couldn't connect to spammimic.com", 1) content = f.read() soup = BeautifulSoup(''.join(content)) data = soup.textarea.string try: fd = open(output, 'w') fd.write(data) fd.close() except: error("Couldn't write to \"%s\"" % output, 1) elif option == "decode_space": params = {} params['cyphertext'] = string; params = urllib.urlencode(params) try: f = urllib.urlopen("http://spammimic.com/decodespace.cgi?%s" % params) except: error("Couldn't connect to spammimic.com", 1) content = f.read() soup = BeautifulSoup(''.join(content)) data = soup.findAll('input')[1]['value'] try: fd = open(output, 'w') fd.write(data) fd.close() except: error("Couldn't write to \"%s\"" % output, 1) else: print "\"%s\" is inavlid option." % option sys.exit(1) if __name__ == "__main__": main() |
You’ll find it in the projects page
or just click here to download it
about 8 months ago
Thanks for the code. I really appreciate of posting this.
about 1 month ago
Nice one. Always handy to have a few alternatives when it comes to encoding messages to stop prying eyes.