It looks like you're new here. If you want to get involved, click one of these buttons!
import urllib2
import urllib
import sys
#########################################################################
# #
# Copyright (C) 2010 LeXeL #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
#########################################################################
def main():
builder()
argv = len(sys.argv)
if argv == 5 or argv ==3:# Revisa si los argumentos son correctos
try:
if '-f' in sys.argv:
try:
file = sys.argv[sys.argv.index(\"-f\")+1]#busca el valor que se encuentra despues de \"-f\"
f = open(file, \"r\")
code = f.read()
except:
print \"There was a problem reading the file!\"
if '-t' in sys.argv:
tipe = sys.argv[sys.argv.index(\"-t\")+1]
if '-t' not in sys.argv:
tipe = ''
start(code,tipe)
except:
print \"There was an Error with the commands\n-f: File were the code is located\n-t: Type of code[Perl,PHP,Python,etc]\"
sys.exit(1)
##
else:
print \"There was an Error with the commands\n-f: File were the code is located\n-t: Type of code[Perl,PHP,Python,etc]\"
sys.exit(1)
def builder():#Construye el builder que se usara
opener = urllib2.build_opener(urllib2.HTTPHandler())
opener.addheaders = [('User-agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')]
urllib2.install_opener(opener)
def start(code,tipe):
site = \"http://pastebin.com/api_public.php\"
values = {'paste_code':code,'paste_format':tipe,'paste_expire_date':'N','paste_private':'1','paste_subdomain':'','paste_name':'','paste_email':'','submit':'submit'}
data = urllib.urlencode(values)
req = urllib2.Request(site, data)
response = urllib2.urlopen(req)
the_page = response.read()
print \"\n[URL]\",the_page
if __name__ == '__main__':
main()
C:\Python26>pastebin.py -f d0wn.py -t python
[URL] http://pastebin.com/RRaqgm93