Last active
May 6, 2019 21:49
-
-
Save heroinbob/8b0b5e68f869b8af1fe6 to your computer and use it in GitHub Desktop.
CarFax License Plate Searcher 9000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment