• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Python and pfSense

Scheduled Pinned Locked Moved Development
2 Posts 2 Posters 714 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    John Willard
    last edited by Mar 12, 2024, 10:14 PM

    Hi there - I understand most of the fundamentals of Python (will learn the rest as needed at this point) and I want to get into automating the task of pulling source IPs and destination ports to record port scans and report them to AbuseIPDB. Starting from knowing most of the fundamentals of Python - what else should I read up on to help me achieve this task? I.e. Does pfSense have an API I haven't been able to find, do I need to use an IDS like Snort, etc.?

    G 1 Reply Last reply Mar 13, 2024, 5:45 PM Reply Quote 0
    • G
      Gertjan @John Willard
      last edited by Gertjan Mar 13, 2024, 5:46 PM Mar 13, 2024, 5:45 PM

      @John-Willard

      pfSense has python.
      Open up a command line : console, or SSH into pfSEnse, and fire it up :

      [23.09.1-RELEASE][root@pfSense.bhf/tld]/root: python3.11 -h
      usage: python3.11 [option] ... [-c cmd | -m mod | file | -] [arg] ...
      Options (and corresponding environment variables):
      -b     : issue warnings about str(bytes_instance), str(bytearray_instance)
               and comparing bytes/bytearray with str. (-bb: issue errors)
      -B     : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x
      -c cmd : program passed in as string (terminates option list)
      -d     : turn on parser debugging output (for experts only, only works on
               debug builds); also PYTHONDEBUG=x
      ........
      

      Be aware : pfSense is a firewall, not a dev system.
      You'll have a hard time pulling in more packages and other tools that maybe not present in the base system.

      @John-Willard said in Python and pfSense:

      Does pfSense have an API

      pfSense is build upon the FreeBSD kernel, and that one is 100 % open source.
      But again : it's probably not on pfSense that you develop anything, it's not the correct environment.

      Btw : Snort, Surriata, Wireshark etc are all binaries, certainly not "interpreted scripts" ;)

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      1 Reply Last reply Reply Quote 0
      2 out of 2
      • First post
        2/2
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
        This community forum collects and processes your personal information.
        consent.not_received