# # Ridiculously basic script to search license plate combinations. # I removed the user-agent and cookie headers that I copied from # chrome, but if you need them just add your own user-agent and # cookie from the carfax site back in. # # You'll need to change the possibilites, plate pattern and regex # to suite your needs. I wrote this in about 5 minutes so it's # basic, crude and pretty unmaintainable, but gives you a sense # of what can be done. require 'htmlentities' require 'cgi' letters = ('A'..'Z').to_a possibilities = letters.product letters hits = [] possibilities.each do |combos| combos.each do |combo| plate = "XXX#{combo}XXX" # Change to suite your needs! response = `curl -s 'http://www.carfax.com/processQuickVin.cfx?partnerCode=CFX&partnerSiteLocation=Y&checkReport=DEC&checkReportVersion=30&fid=&test=&cctest=&affiliateId=&subId=&bannerName=&partnerCode=CFX&partnerSiteLocation=Y&checkReport=DEC&checkReportVersion=30&fid=&test=&cctest=&affiliateId=&subId=&bannerName=&licensePlateNumber=#{plate}&licensePlateState=CA' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'Referer: http://www.carfax.com/'` if response =~ /year=(\d{4})&make=(\w+)&model=(.+?)&recordCheckType/ hits << { plate: plate, year: $1, make: $2, model: $3 } puts "Found #{hits.last[:plate]} #{hits.last[:year]} #{hits.last[:make]} #{CGI.unescape(HTMLEntities.new.decode hits.last[:model])}" end end end puts "Found #{hits.count} plates..." puts hits.inspect