Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import mysql.connector
  2.  
  3. print 'Connecting...'
  4. cnx = mysql.connector.connect(user='root', database='matovt', password='')
  5. cursor = cnx.cursor()
  6. print "Selecting..."
  7. records = {}
  8. cursor.execute("SELECT `id`,`shasum`, `permalink` FROM virustotals", ())
  9. for (id, shasum, permalink) in cursor:
  10. start = permalink.find("file/")
  11. end = permalink.find("/analysis")
  12. sha256 = permalink[(start + 5):end]
  13. records[id] = sha256
  14.  
  15. for id in records.keys():
  16. print "Updating (", id, ", ", records[id], ", ", len(records[id]), ")"
  17. x = cursor.execute('UPDATE `virustotals` SET `shasum` = %s WHERE `id` = %s', (records[id], id))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement