Aquarthur/urlscanio

Any ideas how to do this?

deadjdona opened this issue · 1 comments

This tool requires an environment variable named URLSCAN_API_KEY containing your API key. Optionally, you may also set an environment variable called URLSCAN_DATA_DIR to specify where the screenshots and DOM should be downloaded. If not set, they will be downloaded in the directory you run urlscanio from.

It is recommended to use .bashrc or .zshrc for this. If using PowerShell, add URLSCAN_API_KEY and URLSCAN_DATA_DIR to your user profile.

Where could i find simple explanation how to use .bashrc for "this"? This stuff looks darn overcomplicated comparing to urlscan.io website.

Hey @deadjdona ! This is meant to be a CLI tool, which is most useful for folks who are often using their terminal. If you prefer the website's interface, that's not a worry at all! That said, if you do want to use this tool, I'll try to cover some of what you need to know before continuing.

bash & zsh are two different shells that you can use to run the tool in. .bashrc (and .zshrc) are files that should exist in your home folder. When you start a new shell, you can find out what your home folder is by checking echo $HOME. .bashrc and .zshrc are executed when you start up a new instance of a shell. .bashrc gets executed when you start bash, and .zshrc gets executed when you start zsh.

Just to be clear, you only need one of these files depending on which shell you're using! Most Unix systems have bash as the default shell, so moving forward, I'll deal with .bashrc. The following would be almost exactly the same for zsh/.zshrc.

If you want URLSCAN_API_KEY and URLSCAN_DATA_DIR in your environment at all times, including it in either rc file is a great way to do it! If you don't have one yet, create a .bashrc in your home folder by running:

touch $HOME/.bashrc

Open it up in your favorite editor (if you use VSCode and have the CLI installed, just run code $HOME/.bashrc), and add the following lines:

# very basic example .bashrc/.zshrc file
export URLSCAN_API_KEY="insert your api key here"
export URLSCAN_DATA_DIR="/some/folder"

Now, open up a new shell (or run source $HOME/.bashrc) and check to see if the environment variables exist:

echo $URLSCAN_API_KEY
echo $URLSCAN_DATA_DIR

If they print something out, you're good to go! You can now use the urlscanio command without having to manually set the API key and data directory every time - they'll automatically be configured for you when bash starts up.

For a more complete guide on .bashrc and .zshrc, a quick Google will give you plenty of articles such as this one. Just know that before you know it, you can very quickly end up in a bit of a rabbit hole for shell scripting and setup 😁 It's worth learning though, in my opinion.