1

I have a list of ip addresses in a file, we can call that file ip.txt I scanned a subnet using zmap at port 80. So I have about 100 addresses returned into that file. Instead of popping each ip into a web browser, how would I programmatically go about having a script go through the file and capturing a web page per active ip into a jpg file and saving it in the local directory. I am more of a network/admin guy than a programmer. So the end result would be a capture of active web pages into a directory.

  • this may provide some answers .... google linux headless web browser screenshot – jsotola Oct 13 '18 at 2:17
0

Use this loop (Chromium) :

#!/bin/bash

while read ip; do
    # chromium or chromium-browser on some Linux distributions
    chromium --headless --disable-gpu --screenshot "http://$ip"
    mv screenshot.png "${ip}.png"
    convert "${ip}.png" "${ip}.jpg" # require ImageMagick
done < ip_list.txt

Or this loop (Firefox) :

#!/bin/bash

while read ip; do
    firefox -headless -screenshot "http://$ip"
    mv screenshot.png "${ip}.png"
    convert "${ip}.png" "${ip}.jpg" # require ImageMagick
done < ip_list.txt
  • Advice to newcomers: If an answer solves your problem, please accept it by clicking the large check mark (✓) next to it and optionally also up-vote it (up-voting requires at least 15 reputation points). If you found other answers helpful, please up-vote them. Accepting and up-voting helps future readers. Please see the relevant help-center article – Gilles Quenot Oct 14 '18 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.