Package: lazy-nessus
Lazy-NessusDescriptionI made this script for me to not have to log into Nessus every time I wanted to pause/resume a scan because I am lazy and I don't like logging into my computer at 3 AM. I also added Telegram support since I'm paranoid and want to make sure my actions actually worked.What started as a simple script to pause/resume scans has turned into a full-fledged CLI tool for Nessus. I have added the ability to list scans, check the status of a scan, export a scan, search for a scan, pause a scan, and resume a scan. I have also added the ability to use a .env file to store your API keys and other variables. This is useful if you want to use the Telegram bot functionality. I have also added the ability to pass all variables as command line arguments if you do not want to use a .env file.RequirementsPython 3Nessus Professional or Nessus ManagerTelegram Bot (optional)InstallationPip or pipx installpipinstalllazy-nessuspipxinstalllazy-nessusCreate a Telegram Bot (optional)Create a .env file in your home directory and add your API keys and other variables (see below) (optional)Run the scriptExample .env fileAll optional variables are added. If you do not want to use the .env file, you can pass the variables as command line arguments.TELEGRAM_BOT_TOKEN="1234567890:ABCDEF1234567890"
TELEGRAM_CHAT_ID="1234567890"
NESSUS_API_TOKEN="1a2b3c4d-1a2b-3c4d-1a2b-3c4d1a2b3c4d"
NESSUS_X_COOKIE="1a2b3c4d1a2b3c4d1a2b3c4d1a2b3c4d1a2b3c4d1a2b3c4d"
NESSUS_PASSWORD="1a2b3c4d5e6f7g8h9i0j"ExamplesList all scanslazy-nessusscanslistCheck the status or a single scan on a given serverlazy-nessusscanscheck-S192.168.250.158-s13Pause a scan at a specific time with known API token and X-Cookielazy-nessusscanspause-S10.10.10.10-p8080-s11-t"2021-01-01 00:00"-tT"1234567890:ABCDEF1234567890"-tC"1234567890"-aT"1a2b3c4d-1a2b-3c4d-1a2b-3c4d1a2b3c4d"-c"1a2b3c4d1a2b3c4d1a2b3c4d1a2b3c4d1a2b3c4d1a2b3c4d"-vResume a localhost scan at a specific time using a passwordlazy-nessusscansresume-p8080-s11-t"2021-01-01 09:45"-p"1a2b3c4d5e6f7g8h9i0j"Export a scan as a .nessus filelazy-nessusscansexport-fnessus-s4-p"1a2b3c4d5e6f7g8h9i0j"Search for a scan by namelazy-nessusscanssearch-s"Scan Name"How to obtain the Nessus API token and X-CookieLog into NessusOpen the developer tools in your browserGo to the Network tabClick on something like "All Scans" or "My Scans" under FOLDERSLook for the GET request tofoldersand click on itFrom the Headers tab, copy the X-Cookie valueAFTER"token=" and paste it into the .env fileFrom the Headers tab, copy the X-API-Token value and paste it into the .env fileAlso note the scan ID from the URL (e.g.https://nessus.example.com/#/scans/reports/11/hosts)How to obtain the Telegram bot token and chat IDStart a chat with the BotFatherSend the BotFather the start message/startSend the BotFather the newbot message/newbotAnswer the BotFather's questions to finsh setting up the bot. Keep in mind that your bot name will be searchable by all Telegram users.Save your bot's API key for future reference.Start a chat with your bot and then navigate tohttps://api.telegram.org/bot123456789:jbd78sadvbdy63d37gda37bd8/getUpdatesand replace your API key in the URL.IT NEEDS TO START WITH 'bot' SO KEEP THAT PART OF THE URL.You will likely get a blank result until you send your bot another message and refresh the getUpdates URL.Once you see updates from the URL, note your 'chat_id'. You can use the combination of chat ID and your API key to send automated alerts.EXAMPLE:curl "https://api.telegram.org/bot123456789:jbd78sadvbdy63d37gda37bd8/sendMessage?chat_id=123456&text=%22You just got a shell! Go check your C2 server!%22"Copy the "id" value and paste it into the .env fileCopy the "token" value and paste it into the .env fileDevelopmentWindowsClone this repositorygitclonehttps://github.com/minniear/lazy-nessus.gitInstall the requirements, preferably in a virtual environmentpython3-mvenvlazy-nessuscdlazy-nessus
Scripts\activate.bat
pipinstall-rrequirements.txtCreate a Telegram Bot (optional)Create a .env file in your home directory and add your API keys and other variables (see above) (optional)Linux/MacClone this repositorygitcloneInstall the requirements, preferably in a virtual environmentpython-mvenvlazy-nessuscdlazy-nessussourcebin/activate
pipinstall-rrequirements.txtCreate a Telegram Bot (optional)Create a .env file in your home directory and add your API keys and other variables (see above) (optional)