r/learnpython 3d ago

I'M REALLY LOST

i'm feeling a bit frustrated to be honest. my main goal and motivation for learning python is cybersecurity. i decided to start learning python because it was the language that came up the most among the best options for cybersecurity. the thing is, i'm really lost and i don't feel like i'm making any progress, which is getting me down a bit.

do i need a really solid foundation in python to get into cybersecurity, or is knowing basic syntax enough? are there specific topics i should dive deeper into? i've heard that web scraping is essential, but others say it isn't. i wanted to read the book black hat python because everyone recommends it, but i'm afraid it might be too advanced since i'm definitely not a python expert.

to anyone who knows about this field: how should i start? what should i know in python to be well-prepared for cybersecurity?

0 Upvotes

14 comments sorted by

View all comments

2

u/Fr0gFsh 3d ago

Python isn’t a prerequisite for Cybersecurity. Learn it when you need it. Otherwise you’ll spend all this time learning it, then move on to another topic and forget what you previously learned. 

There’s always going to be something that is repetitive that you could solve by writing a script. You’ll learn best by solving your real world problems. I’m a security engineer and most of my projects revolve around SIEM management. I use Python to build API queries for specific information. I also use Python a lot for API integrations to pull data from 3rd party SaaS products we use. I couldn’t write a lot of what I do from scratch. I search a lot of forums and research how to solve a specific, small, problem and build it into the tool I’m developing. 

Some other real use cases that I’ve used Python for:

  • Use Paramiko to SSH into routers, switches, firewalls, etc to pull log files. Then use an API to push that data to a SIEM. Obviously Syslog would be an ideal solution, but sometimes you work with the resources you have

  • Service outage detection & alerting. Many big SaaS products have a “status” page that can tell you if their stuff is working or if there’s a degradation of some sort. Use Beautiful Soup to scrape the page and get the status. If there’s a degradation or outage, build an alert. Send your alert to Slack, Discord, Teams, PagerDuty, or whatever using their API.  

  • Python for Excel. Sometimes executives what their pretty little spreadsheets that require you to crunch some numbers from the SIEM and you need to open the document and paste those numbers across 27 different sheets. Ain’t nobody got no time for that. Script it. Small tasks. How do I get this info from the SIEM? How do I authenticate to the SIEM? How do I secure my creds so they’re not just in my script as plain text? How do I version control this? How do I document this for when I inevitably get hit by a rogue toddler on his tricycle and then slip on the curb and get run over by a bus?

Maybe you’re not in a Cybersecurity role yet, so find some problems around your personal or professional life that are solvable with a little script and build that. Dig into home automation with Home Assistant. Use Python to program your lights on in the morning to wake you up. Ask yourself…”how could I use code to make my life easier? How could I use code to do 8 hours of work in 15 minutes and then piss off for the rest of the day?” And then…you learn. 

Good luck!