Guest User

Untitled

a guest
Apr 6th, 2018
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. ```
  2. #
  3. # This script builds a database containing credentials, in order to check if email+password have leak.
  4. # For a few searchs, the grep command is perfect. No need of an aircraft carrier for fishing in a lake. ;)
  5. # Data source contains 1.4 billon (yes, billon!) passwords from 4iQ (41GB large)
  6. #
  7. # PS: Use. Don't abuse !
  8. #
  9.  
  10. mkdir 1.4B-password-dump/
  11. cd 1.4B-password-dump/
  12.  
  13. # Download dump
  14. aria2c 'magnet:?xt=urn:btih:7ffbcd8cee06aba2ce6561688cf68ce2addca0a3&dn=BreachCompilation&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fglotorrents.pw%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337'
  15.  
  16. # start a postgres instance
  17. docker run -d --name password-dump \
  18. -p 5432:5432 \
  19. -v ./BreachCompilation/data:/data \
  20. -e POSTGRES_USER=dump \
  21. -e POSTGRES_PASSWORD=dump \
  22. -e POSTGRES_DB=dump \
  23. postgres:10
  24.  
  25. # get a psql prompt
  26. docker exec -it password-dump psql postgres://dump:dump@localhost:5432/dump
  27.  
  28. # Create a table
  29. CREATE TABLE credentials (
  30. email VARCHAR NOT NULL,
  31. pass VARCHAR NOT NULL
  32. );
  33.  
  34. # Create an index for fast querying
  35. CREATE INDEX credentials_email ON credentials (email);
  36. CREATE INDEX credentials_pass ON credentials (pass);
  37.  
  38. # Run next commands into tmux. Dump import will take many hours ;)
  39. tmux
  40.  
  41. # The \copy command from postgres is too strict for raw data
  42. # \copy credentials(email, pass) FROM '/data/0/0' DELIMITER ':' CSV;
  43.  
  44. # Run a go script instead and pipe results into pg
  45. tree -CfiF ./BreachCompilation/data \
  46. | grep -v '/$' \
  47. | xargs cat \
  48. | go run parser.go \
  49. | docker exec -i password-dump psql postgres://dump:dump@localhost:5432/dump
  50.  
  51. # Command to keep track of import on postgres side (unfortunately, it may slow down import)
  52. \watch 'SELECT COUNT(*) FROM credentials;'
  53. ```
Add Comment
Please, Sign In to add comment