Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
OBIShell
#!/usr/bin/env python
#coding: utf8
import os
if os.name=="posix":
os.system("clear")
if os.name in ("nt","dos","ce"):
os.system("cls")
class colors:
head = '\033[95m'
blue = '\033[94m'
green = '\033[92m'
warning = '\033[93m'
fail = '\033[91m'
end = '\033[0m'
sub = colors.green + """
\t ,-----. ,-----. ,--. ,---. ,--. ,--.,--.
\t' .-. '| |) /_ | |' .-' | ,---. ,---. | || |
\t| | | || .-. \| |`. `-. | .-. || .-. :| || |
\t' '-' '| '--' /| |.-' || | | |\ --.| || |
\t `-----' `------' `--'`-----' `--' `--' `----'`--'`--'
""" + colors.end + colors.fail + "\t\tcontact: erayarslan.com" +colors.end
print sub
################################################################################
from mechanize import Browser
import getpass,re,sys,urllib
br = Browser()
br.set_handle_robots(False)
br.open("http://www.obis.sakarya.edu.tr")
br.select_form(nr=0)
print ""
un = raw_input(" "+colors.blue+"obis-username [>] "+colors.end)
pw = getpass.getpass(" "+colors.blue+"obis-password [>] "+colors.end)
print ""
print " "+colors.green+"[x] Getting informations..."+colors.end
print ""
br.form['frm_kullanici'] = un
br.form['frm_sifre'] = pw
br.submit()
if br.geturl()!="http://www.obis.sakarya.edu.tr/":
print " "+colors.fail+"[-] Login Error"+colors.end
sys.exit("")
veri0 = br.response().read()
for x0 in re.findall(r'<td class="bgc11"><b>(.*)</b></td>', veri0,re.M):
print " "+colors.blue+"[+] "+x0.decode('iso-8859-9')+colors.end
print ""
print " "+colors.green+"[x] Getting 'AKTS Transkript'..."+colors.end
print ""
data = {
'page' : 'transkript_akts',
}
br.open( "http://www.obis.sakarya.edu.tr", urllib.urlencode( data) )
veri1 = br.response().read()
for x1 in re.findall(r'''<tr class="bgc11">
<td align="left" colspan=2 valign="top">(.*)</td>
<td align="center" valign="top">(.*)</td>
<td align="center" valign="top">(.*)</td>
<td align="center" valign="top">(.*)</td>
</tr>''', veri1,re.M):
notx = x1[1]
if(x1[1]=="FF"):
notx = colors.fail+"FF"+colors.end
elif(x1[1]=="GR"):
notx = colors.fail+"GR"+colors.end
elif(x1[1]=="AA"):
notx = colors.green+"AA"+colors.end
else:
notx = colors.end+x1[1]+colors.end
asd = " "+colors.blue+"[+] "+"%s%s"+colors.end
print asd % (str(x1[0]).decode('iso-8859-9').ljust(40),str(notx).ljust(10))
print ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment