Underc0de

Programación Scripting => Python => Mensaje iniciado por: k0ws en Abril 16, 2013, 07:31:00 PM

Título: [Función] ExisteEnLaWeB
Publicado por: k0ws en Abril 16, 2013, 07:31:00 PM
Bueno, hacia algo de tiempo que no codeaba y me decidi a traer esta pequeña funcion:

Código (python) [Seleccionar]
'''
Coder: k0ws | If you use this code or part of it, please, credit ;)
'''

import httplib, sys
def buscaArchivoWeb():
try:
  if (sys.argv[1] == "-h"):
   print '\nUse: py_filename.py -w www.host.com -f http://www.host.com/remote_file.ext';
   return;
  else:
   sHost = sys.argv[2];
   sFile = sys.argv[4];
   sCon = httplib.HTTPConnection(sHost);
   sCon.request("GET",sFile);
   sRes = sCon.getresponse().status;
   print '\nWeb: ' + sys.argv[2];
   print 'Remote File: ' + sys.argv[4];
   print 'Remote File Status: ' + str(sRes);
   if sRes == 200:
    print 'Remote Response: The file exist :D';
   else:
    print 'Remote Response: The file doesnt exist!';
except:
print '\nError: I need at least two parameters for working | Remember, the file needs the http:// header for working, the host can be definite like www.server...';

buscaArchivoWeb();




Con esta pequeña funcion se podria hacer un Admin Panel Finder en cuestion de minutos  8)

-Saludos-
Título: Re:[Función] ExisteEnLaWeB
Publicado por: Acidkode en Abril 16, 2013, 09:47:48 PM
bonito, se agradece   :)
Título: Re:[Función] ExisteEnLaWeB
Publicado por: JaAViEr en Abril 22, 2013, 01:35:52 PM
Hola, buen día.

Podrías hacerlo más sencillo con urllib o urllib2 y solo usar getcode(), si es el status code es 200, existe.

Saludos.
Título: Re:[Función] ExisteEnLaWeB
Publicado por: k0ws en Abril 22, 2013, 06:07:17 PM
@JaAViEr No se me había ocurrido, me lo apunto.  ;)

-Saludos-
Título: Re:[Función] ExisteEnLaWeB
Publicado por: JaAViEr en Abril 22, 2013, 08:50:49 PM
No tienes permitido ver enlaces. Registrate o Entra a tu cuenta
@JaAViEr No se me había ocurrido, me lo apunto.  ;)

-Saludos-
Va a estar buena la V2 ;)
Título: Re:[Función] ExisteEnLaWeB
Publicado por: Mr. Foster en Abril 23, 2013, 10:50:32 AM
se agradece, pero le soy fiel al DirBuster  :'(