adonisslanic Posted March 28, 2009 Report Posted March 28, 2009 Am o problema in Visual Basic 2008...Vreau sa stiu si sa inteleg cum se pot citi datele dintr-un fisier .txt care se afla pe un site de-al meu...Stiu cum se citesc fisierele din calculator, dar vreau sa fac acelasi lucru si cu fisierele de pe internet... Ca am mai vazut un cititor pe hackthissite.org la misiuni cu cracking, si am observat ca folosea winsock... Va rog mult ajutati-ma si dati-mi un cod ceva... :confused: Quote
PClaudiu Posted May 15, 2009 Report Posted May 15, 2009 Man, use Python. Termini in 5 minute. Folosesti urllib2 sau doar urllib si asta e tot. E plin netul de tutoriale. Quote
darkking Posted June 24, 2009 Report Posted June 24, 2009 WebRequest req = WebRequest.Create("adresa site");WebResponse response = req.GetResponse();Stream stream = response.GetResponseStream();private byte[] downloadedData;byte[] buffer = new byte[1024];MemoryStream memStream = new MemoryStream();downloadedData = new byte[0]; while (true) {int bytesRead = stream.Read(buffer, 0, buffer.Length);memStream.Write(buffer, 0, bytesRead);}downloadedData = memStream.ToArray();stream.Close();memStream.Close();FileStream newFile = new FileStream(@"C:\zTmp.txt", FileMode.Create);newFile.Write(downloadedData, 0, downloadedData.Length);newFile.Close(); Quote
Laur13 Posted July 5, 2009 Report Posted July 5, 2009 cu codu ila poti sa citesti config.php dintrun site? Quote
cmiN Posted July 5, 2009 Report Posted July 5, 2009 Sau in python:1) Salvezi in ufr.py script-ul:#! /usr/bin/env python# 05.07.2009 <> 05.07.2009 | cmiN# URL-File-Reader 4 adonisslanic @ rstcenter.comimport os, sys, urllib2, urlparsedef main(): args=sys.argv if len(args) != 2: print("\tUsage:\n\n\\tufr.py http://www.site.com/path/file\n\n\Press any key to exit. . .\n\n\n") else: print("Please wait...\n\n") url=args[1] splited_path=urlparse.urlsplit(url).path.split("/") filename=splited_path[len(splited_path)-1] sock=urllib2.urlopen(url) source=sock.read() sock.close() f=file(filename, "w") f.write(source) f.close() print("Ready! Check %s." % filename)if __name__=="__main__": try: main() except: print("Invalid URL or timed out!") os.system("pause >NUL")2) Start -> Run -> cmd -> cd %locatie% unde %locatie% este path-ul unde se afla ufr.py3) ufr.py -> vezi usageCiteste orice fisier de tip ASCII din URL, URL care poate folosi orice protocol http/ftp/etc si ii salveaza datele intact intr-un fisier cu numele si extensia celui citit din URL in acelasi folder unde se afla si script-ul. Quote
adonisslanic Posted August 18, 2009 Author Report Posted August 18, 2009 Mersi mult pentru suportul acordat! Quote