Giter VIP home page Giter VIP logo

Comments (10)

magarjoba avatar magarjoba commented on June 16, 2024
+ ... .$($version.results.current.minor).$($version.results.current.patch)"
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastParseTargetInvocation
 
my command from test:  Invoke-FGTRestMethod -method "get" -uri "api/v2/monitor/system/interface" -connection $fw3 | Format-Table
-----------------------------------------------------------------------------------------------------------------------

http_method results                                                                                       vdom path   name      action status  serial           version build
----------- -------                                                                                       ---- ----   ----      ------ ------  ------           ------- -----
GET         @{wan1=; wan2=; modem=; internal1=; internal2=; internal3=; internal4=; internal5=; usb-wan=} root system interface select success FGT40C0123456789 v5.2.15   766

from powerfgt.

alagoutte avatar alagoutte commented on June 16, 2024

Hi,

the release 5.x is EOL and and it is very limited support of API...

from powerfgt.

alagoutte avatar alagoutte commented on June 16, 2024

and about filtering i think, it is coming with 6.0.x

from powerfgt.

magarjoba avatar magarjoba commented on June 16, 2024

The API works.
I tested many points both by rules and by interfaces.

the only problem is filtration ...
I'm sure you can somehow do filtering without API. but by means of built-in methods of powershell, but my knowledge is not enough for this. ((((

+ ... .$($version.results.current.minor).$($version.results.current.patch)"
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastParseTargetInvocation
 
my command from test2:  Get-FGTSystemInterface -connection $fw3 -name wan  | Select  name, username, password, status, mode , ip , speed, mtu, mtu-override | format-table
-----------------------------------------------------------------------------------------------------------------------

name       username password status mode   ip                          speed  mtu mtu-override
----       -------- -------- ------ ----   --                          -----  --- ------------
GUEST-WIFI          ENC XXXX up     static 10.0.100.1 255.255.255.0 auto  1500 disable     
co-3g-w1            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
co-3g-w2            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
co-4g-w1            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
co-4g-w2            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
co-l3-w1            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
co-l3-w2            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
co-l3-w3            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
co-l3-w4            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
internal1           ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
internal2           ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
internal3           ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
internal4           ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
internal5           ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
lan                 ENC XXXX up     static 192.168.1.99 255.255.255.0  auto  1500 disable     
modem               ENC XXXX down   pppoe  0.0.0.0 0.0.0.0             auto  1500 disable     
ssl.root            ENC XXXX up     static 0.0.0.0 0.0.0.0             auto  1500 disable     
usb-wan             ENC XXXX up     dhcp   0.0.0.0 0.0.0.0             auto  1500 disable     
wan1                ENC XXXX up     dhcp   192.168.0.50 255.255.255.0 auto  1500 disable     
wan2                ENC XXXX up     dhcp   0.0.0.0 0.0.0.0             auto  1500 disable     

from powerfgt.

alagoutte avatar alagoutte commented on June 16, 2024

for version, can you try this command for i get the output..

Invoke-FGTRestMethod -u api/v2/monitor/system/firmware).results.current

name         : FortiOS
id           : current
version      : v7.0.0
major        : 7
minor        : 0
patch        : 0
build        : 66
branch-point : 66
release-type : GA
notes        : https://docs.fortinet.com/document/fortigate/7.0.0/fortios-release-notes/
source       : current
platform-id  : FGT60F

for filtering with Powershell, you can use Where-Object

for example

Get-FGTSystemInterface | Where-Object {$_.name -eq "wan1"} | Select  name, username, password, status, mode , ip , speed, mtu, mtu-override  | ft

name username password status mode   ip                           speed  mtu mtu-override
---- -------- -------- ------ ----   --                           -----  --- ------------
wan1                   up     static 192.168.44.144 255.255.255.0 auto  1500 disable

from powerfgt.

magarjoba avatar magarjoba commented on June 16, 2024
Invoke-FGTRestMethod -u api/v2/monitor/system/firmware).results.current

hm.... is this exactly the correct command?

 $fs=Connect-FGT 192..168.99 -SkipCertificateCheck -DefaultConnection:$false -Timeout 15
Invoke-FGTRestMethod -method "get" -uri "api/v2/monitor/system/firmware" -connection $fs


+ ... .$($version.results.current.minor).$($version.results.current.patch)"
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastParseTargetInvocation
 

http_method : GET
results     : @{current=; available=System.Object[]}
vdom        : root
path        : system
name        : firmware
action      : select
status      : success
serial      : FGT40C0123456789
version     : v5.2.15
build       : 766

found a book for previous OS

http://www.tuncaybas.com/FOS_JSON_REST_API_523.pdf

this is work Get-FGTSystemInterface | Where-Object {$_.name -eq "wan1"}

+ ... .$($version.results.current.minor).$($version.results.current.patch)"
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastParseTargetInvocation
 


name         : wan1
username     : 
password     : ENC XXXX
status       : up
mode         : dhcp
ip           : 10.30.20.10 255.255.255.0
speed        : auto
mtu          : 1500
mtu-override : disable

from powerfgt.

alagoutte avatar alagoutte commented on June 16, 2024

missing a first parenthese

(Invoke-FGTRestMethod -method "get" -uri "api/v2/monitor/system/firmware" -connection $fs).results

and

(Invoke-FGTRestMethod -method "get" -uri "api/v2/monitor/system/firmware" -connection $fs).results.current

from powerfgt.

magarjoba avatar magarjoba commented on June 16, 2024
+ ... .$($version.results.current.minor).$($version.results.current.patch)"
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastParseTargetInvocation
 

current                                                                                                                                                                                                available
-------                                                                                                                                                                                                ---------
@{name=FortiOS; id=current; version=v5.2.15; build=766; branch-point=766; release-type=GA; notes=http://docs.fortinet.com/d/fortios-5.2.15-release-notes/download; source=current; platform-id=FGT40C} {}       

 ... .$($version.results.current.minor).$($version.results.current.patch)"
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastParseTargetInvocation
 


name         : FortiOS
id           : current
version      : v5.2.15
build        : 766
branch-point : 766
release-type : GA
notes        : http://docs.fortinet.com/d/fortios-5.2.15-release-notes/download
source       : current
platform-id  : FGT40C

from powerfgt.

alagoutte avatar alagoutte commented on June 16, 2024

Hi

Thanks,i will add a hack/check for detect release 5.x with a warning about missing some feature (like filtering) for next release

from powerfgt.

alagoutte avatar alagoutte commented on June 16, 2024

Ok, i try to look this issue, it is only with very very old release (like 5.2...) but will see what it will make...

from powerfgt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.