Jump to content

Rooty

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Rooty

  1. Ahh from the message body, that's an interesting one and very difficult to protect against perfectly. Really you need your spam software to be catching this because you need something to normalise the diacritics before checking for censored words/content. What are you using as your mail and anti-spam solution?
  2. No worries, glad it was of some use/help! There's many ways to do it, I often load in a JSON file because I like the structure of it, and work with it a lot to make REST APIs so it feels natural. There's ways using INI files and the configparser and so on, whatever suits you best: https://docs.python.org/3/library/configparser.html I'm not familiar with .exe compilation unfortunately as I'm strictly *nix! Once you get a lot more advanced you can do things like distribute your packages/programs over pip so that people can simply `pip install mymonitoringtoolthing` and install it that way (pip can install tools as well as packages).
  3. As above, try using curl from an internal machine with the '-v' flag to put it in verbose mode.
  4. Depending upon the distribution you're using, there's many ways to achieve this, but an ideal way would be to run this as a systemd unit. Take a look at this Stack Overflow answer: https://askubuntu.com/questions/919054/how-do-i-run-a-single-command-at-startup-using-systemd
  5. You could probably achieve a lot of this using something as simple as Google Sheets or even Microsoft Excel. If it needs to be a web page, ignoring where it'll be hosted and so on, you could achieve this with just some HTML and some fairly simple javascript realistically. If you're comfortable with tech then you could learn how to do this yourself, otherwise you'd need to find/hire someone to do it - it's not a huge job assuming all the requirements are in your post. Something like WordPress is a firehose to put out a match, and you'll end up fudging complicated plugins together that just about get what you want - and then they'll break next update. It sounds simple-ish as it is, it depends on the logic required in structuring a timetable, the format it 'spits out', how you're hosting/accessing it, and so on. Any questions feel free to message me!
  6. Nice little script! I do a lot of Python automation and scripting as part of my job, and thought I'd offer some pointers if they're of any use or interest to you. Config Separate out your config from the actual program itself. A simple way of doing this is making a config.json file, importing/parsing it and then accessing a config object like `for devices in config`, or you can cheat a bit by making a config.py file with variables, or a single 'config' multi-level dictionary, and import it at the top of the file. You can add this to your .gitignore, and that makes for better practice with config management and keeping a clean repo. It's worth adding the standard Python .gitignore file in to projects as it stops cache files and similar popping up. Is it still working? Instead of incrementing a counter, you could record the timestamp/date of the last successful port open check, and display a 'last checked' instead, to make it clearer when there's an issue, and when it occurred. If you wanted to add a feature, you could track the 'last success' date for each port, that way when a port goes down, upon each screen refresh you can display how many seconds since it was last seen like Icinga2 or other monitoring tools. Sockets Add a `socket.close()` as you're opening sockets and testing that it was successful, but then not doing anything with them, and not triggering sending the FIN packet to the peer. Naming You've got a mix of PascalCase, camelCase, snake_case, and so on (IPAddr, buildCell, iteration_counter...) as well as non-descriptive vars (a, p, c, s). I'd recommend Googling 'PEP 8 Style Guide' as that's the defacto guide that 99% of developers and projects on GitHub and so on will follow. It doesn't cost anything to be descriptive with variables, so try to avoid the single letter names as it can make things complicated at a glance. If you were interested in using some off the shelf software, Icinga2 is built for this kind of thing, and you can add a TSDB backend for graphing etc. It gives you historical tracking, and the ability to monitor almost all aspects of network devices and systems, great bit of software if you've not heard of it, the docs are worth a read. Hope none of these came across wrong, let me know if you had any questions!
  7. Rather than try to filter for what you don't want, have you tried doing the inverse and filtering for only what you do need? Email regex is notoriously tricky, but the following regex from Stack Overflow is good (stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression): (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(??:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(??:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
×
×
  • Create New...