Postări

Se afișează postări din ianuarie, 2023

Add inline javascript with ajax

 Add inline javascript with ajax $ . ajax ({                 headers: { 'X-CSRF-TOKEN' : $ ( 'meta[name="csrf-token"]' ). attr ( 'content' )                             },                 type: 'GET' ,                 url: your_url ,                 data: '' ,                 datatype : 'script' ,                 success : function ( data ) {                     existingscript = document . getElementById ( "newscript" );                     //remove existing script if exists                          i...

FortiOS commands

 Session list: #diag sys session list List sessions with source IP 192.168.0.11 #diag sys session filter src 192.168.0.11 #diag sys session list For NAT-ed sessions: #diag sys session filter nsrc 192.168.0.11 #dig sys session filter nport 445 #diag sys session list sudu global diag sys flash list sudu root config show full

Process Command Line Arguments in Python

To access command line arguments in python one can use sys.argv. sys.argv is a list containing the parameters with which the script was called, including the name of the script at index 0 of the list - sys.argv[0], so in sys.argv[1:] we find the arguments with which the script was called. To parse the list of arguments, getopt.getopt is used. Syntax: getopt.getopt(args, options, [long_options]) (Options that require an argument should be followed by a colon (:).) See the example below: try :         ( options , args ) = getopt . getopt ( sys . argv [ 1 :], 'n:hv' )     except getopt . GetoptError :         usage ()     if len ( args ) != 1 :         usage ()     for ( opt , optval ) in options :         if opt == "-n" :             name = optval         elif opt == "-h" :             sho...