#Pastebin Grabber #1
####First Words:
This is my first tutorial ever ! So if it feel understandable or something, please tell me
####Before starting:
For this tutorial i will use Ruby language
you will need those gems to follow the tutorial :
gem install HTTParty
--> for http request
gem install Nokogiri
--> for web parsing
####How it works :
- Make a search on pastebin website
- Parse all google links to only get pastebin links
- Create threads for inspecting links
- Inspect links and get the combos in a file
Make a search on pastebin site :
We just use the google operator āsite:ā to get only links from pastebin.com followed by our query :
" site:pastebin.com combo email pass "
page = HTTParty.get('http://www.google.com/search?q=site%3Apastebin.com%20combo%20email%20pass')
page_parsed = Nokogiri::HTML(page) #Get a "code readable page"
More informations on google operator here -> Google operators
Get all Pastebin.com links
Just use CSS selectors on our parsed page to get all links.
link_array = []
page_parsed.css('.r a').map do |a| #for each links (CSS selectors)
link_array.push(a["href"][7..-1]) #Get links in an array
end
##Create Threads :
We are going to create threads in order to get quicker results by creating an array of threads.
For each links we got we create a thread and put it on the array.
threads = []
link_array.each do |item|
threads << Thread.new {explore(item)} #Explore funtion in the last part ;)
end
threads.each { |t| t.join }
##Get Results \o/ !
Each thread will :
- Get the page and parse it
- Get the raw data of pastebin
- Compare data to regex
- Write result in a file
def explore(link)
reg = /.*@[a-z]*\.[a-z]{2,3}:\S*/ #email:pass regex
vide = "" #Buffer variable
page = HTTParty.get(link)
page_parsed = Nokogiri::HTML(page)
page_parsed.css('#paste_code').map do |a| #For each line of raw data
a.text.scan(reg).each do |combo|
vide += combo + "\n" #if data match regex, write into buffer
end
File.open('combo.txt', 'w') { |file| file.write(vide) } #write buffer to a file
end
Thatās it, you just create your own Pastebin grabber ! Here come the full code :
require 'HTTParty'
require 'Nokogiri'
def explore(link)
reg = /.*@[a-z]*\.[a-z]{2,3}:\S*/
vide = ""
page = HTTParty.get(link)
page_parsed = Nokogiri::HTML(page)
page_parsed.css('#paste_code').map do |a|
a.text.scan(reg).each do |combo|
vide += combo + "\n"
end
File.open('combo.txt', 'w') { |file| file.write(vide) }
end
end
page = HTTParty.get('http://www.google.com/search?q=site%3Apastebin.com%20combo%20email%20pass')
page_parsed = Nokogiri::HTML(page)
link_array = []
page_parsed.css('.r a').map do |a|
link_array.push(a["href"][7..-1])
end
threads = []
link_array.each do |item|
threads << Thread.new {explore(item)}
end
threads.each { |t| t.join }
(This code actually get 14 000 combos, and it just explore the 1st page of google results)
Thank for reading ! Please comments and feel free to improve the code