![]() post ( 35 " %s /api/firewall/filter/addRule" % remote_uri, auth = ( api_key, api_secret ), verify = False, json = data 36 ) 37 if r. text ) 23 if len ( response ) = 0 : 24 # create a new rule, identified by rule_description allowing traffic from 25 # 192.168.0.0/24 to 10.0.0.0/24 using TCP protocol 26 data = 34 r = requests. get ( 15 " %s /api/firewall/filter/searchRule?current=1&rowCount=7&searchPhrase= %s " % ( 16 remote_uri, rule_description 17 ), 18 auth = ( api_key, api_secret ), verify = False 19 ) 20 21 if r. Resources (SourceNatController.php) – extends : FilterBaseController ¶ġ #!/usr/bin/env python3.7 2 import requests 3 import json 4 5 # key + secret from downloaded apikey.txt 6 api_key = "3RhWOno+HwvtmT406I6zw8of8J6n9FOKlWK6U0B+K7stt/fDaJg7bjeF3QAshlScYqC+3o5TH圓vQViW" 7 api_secret = "uaBk27NKhQCZSDpfAlG6YJ473MzvsCNiED6kzbYuykzU05fCRkcJADhDm5nxbZt8yREC74ZpvD/vbcEx" 8 9 # define the basics, hostname to use and description used to identify our test rule 10 rule_description = 'OPNsense_fw_api_testrule_1' 11 remote_uri = "" 12 13 # search for rule 14 r = requests. ![]() Resources (FilterController.php) – extends : FilterBaseController ¶ ![]() Rules not visible in the web interface ( Firewall ‣ Automation) will not be returned by the API either. ![]() Use your browsers “inspect” feature to compare requests easily, the user interface in terms of communication is exactly the sameĪs offered by the API. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |