Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

SSH

All examples are included with download of MBS FileMaker Plugin.

SSH.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts2
Value Lists0
Custom Functions0
Custom Menus33
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
SSH
8 fields defined, 3 records
SSH

Fields

Table Name: SSH - 8 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
HostNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Global
  • Repetitions: 1
  • Index Language: German
      PortNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Global
      • Repetitions: 1
      • Index Language: German
          UsernameNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Global
          • Repetitions: 1
          • Index Language: German
              PasswordNormal, TextAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Global
              • Repetitions: 1
              • Index Language: German
                  CommandNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                      ResultNormal, TextAuto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Repetitions: 1
                      • Indexing: None
                      • Automatically create indexes as needed
                      • Index Language: German
                          HostKeyHashNormal, TextAuto-Enter:
                          • Allow editing
                          Validation:
                          • Only during data entry
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                              UserAuthListNormal, TextAuto-Enter:
                              • Allow editing
                              Validation:
                              • Only during data entry
                              Storage:
                              • Repetitions: 1
                              • Indexing: None
                              • Automatically create indexes as needed
                              • Index Language: German

                                  Layout Objects: SSH

                                  Regular Fields

                                  Field Name: SSH::Host
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 60 pt
                                  • Left: 138 pt
                                  • Bottom: 74 pt
                                  • Right: 391 pt
                                  • Anchoring: Left, Top
                                  Field Format:
                                  • Edit Box
                                  Field Behavior:
                                  • Allow field to be entered: In Find mode, In Browse mode
                                  • Touch keyboard type: System Default
                                  • Go to next field using: Tab key
                                  No

                                  Field Name: SSH::Port
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 78 pt
                                  • Left: 138 pt
                                  • Bottom: 92 pt
                                  • Right: 391 pt
                                  • Anchoring: Left, Top
                                  Field Format:
                                  • Edit Box
                                  Field Behavior:
                                  • Allow field to be entered: In Find mode, In Browse mode
                                  • Touch keyboard type: System Default
                                  • Go to next field using: Tab key
                                  No

                                  Field Name: SSH::Username
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 96 pt
                                  • Left: 138 pt
                                  • Bottom: 110 pt
                                  • Right: 391 pt
                                  • Anchoring: Left, Top
                                  Field Format:
                                  • Edit Box
                                  Field Behavior:
                                  • Allow field to be entered: In Find mode, In Browse mode
                                  • Touch keyboard type: System Default
                                  • Go to next field using: Tab key
                                  No

                                  Field Name: SSH::Password
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 114 pt
                                  • Left: 138 pt
                                  • Bottom: 128 pt
                                  • Right: 391 pt
                                  • Anchoring: Left, Top
                                  Field Format:
                                  • Edit Box
                                  Field Behavior:
                                  • Allow field to be entered: In Find mode, In Browse mode
                                  • Touch keyboard type: System Default
                                  • Go to next field using: Tab key
                                  No

                                  Field Name: SSH::Command
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 138 pt
                                  • Left: 138 pt
                                  • Bottom: 152 pt
                                  • Right: 391 pt
                                  • Anchoring: Left, Top
                                  Field Format:
                                  • Edit Box
                                  Field Behavior:
                                  • Allow field to be entered: In Find mode, In Browse mode
                                  • Touch keyboard type: System Default
                                  • Go to next field using: Tab key
                                  Yes

                                  Field Name: SSH::Result
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 156 pt
                                  • Left: 138 pt
                                  • Bottom: 362 pt
                                  • Right: 475 pt
                                  • Anchoring: Left, Top
                                  Field Format:
                                  • Edit Box
                                  Field Behavior:
                                  • Allow field to be entered: In Find mode, In Browse mode
                                  • Touch keyboard type: System Default
                                  • Go to next field using: Tab key
                                  Yes

                                  Field Name: SSH::HostKeyHash
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 366 pt
                                  • Left: 138 pt
                                  • Bottom: 380 pt
                                  • Right: 391 pt
                                  • Anchoring: Left, Top
                                  Field Format:
                                  • Edit Box
                                  Field Behavior:
                                  • Allow field to be entered: In Find mode, In Browse mode
                                  • Touch keyboard type: System Default
                                  • Go to next field using: Tab key
                                  Yes

                                  Field Name: SSH::UserAuthList
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 384 pt
                                  • Left: 138 pt
                                  • Bottom: 398 pt
                                  • Right: 391 pt
                                  • Anchoring: Left, Top
                                  Field Format:
                                  • Edit Box
                                  Field Behavior:
                                  • Allow field to be entered: In Find mode, In Browse mode
                                  • Touch keyboard type: System Default
                                  • Go to next field using: Tab key
                                  Yes

                                  Script Hierarchy

                                  Run
                                  Clear

                                  Next Script: [Clear]
                                  Script NameRun
                                  Run script with full access privilegesOff
                                  Include In MenuYes
                                  Layouts that use this script
                                    Scripts that use this script
                                      Script Definition
                                      Script Steps
                                      • # Start a new SSH session
                                      • Set Variable [ $ssh; Value:MBS( "SSH.New" ) ]
                                      • # Connect to an IP
                                      • Set Variable [ $r; Value:MBS( "SSH.Connect"; $ssh; SSH::Host; SSH::Port ) ]
                                      • If [ MBS("IsError") ]
                                      • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                      • Else
                                      • # Run the session handshake.
                                      • Set Variable [ $r; Value:MBS( "SSH.SessionHandshake"; $ssh) ]
                                      • If [ MBS("IsError") ]
                                      • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                      • Else
                                      • # We can show the hostkey. You can compare it to known hostkey.
                                      • Set Field [ SSH::HostKeyHash; MBS( "SSH.HostKey"; $ssh ) ]
                                      • # We query supported authentication ways
                                      • Set Variable [ $authuserlist; Value:MBS( "SSH.userauthlist"; $ssh; SSH::Username) ]
                                      • Set Field [ SSH::UserAuthList; $authuserlist ]
                                      • Set Variable [ $pos1; Value:Position ( $authuserlist ; "password"; 1; 1 ) ]
                                      • Set Variable [ $pos2; Value:Position ( $authuserlist ; "keyboard-interactive"; 1; 1 ) ]
                                      • Set Variable [ $pos3; Value:Position ( $authuserlist ; "publickey"; 1; 1 ) ]
                                      • If [ $pos1 > 0 ]
                                      • # Authenticate with password
                                      • Set Variable [ $r; Value:MBS( "SSH.UserAuthPassword"; $ssh; SSH::Username; SSH::Password ) ]
                                      • If [ MBS("IsError") ]
                                      • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                      • End If
                                      • Else If [ $pos2 > 0 ]
                                      • # Authenticate with answering question. Plugin passes password for answer.
                                      • Set Variable [ $r; Value:MBS( "SSH.UserAuthKeyboardInteractive"; $ssh; SSH::Username; SSH::Password ) ]
                                      • If [ MBS("IsError") ]
                                      • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                      • End If
                                      • Else If [ $pos3 > 0 ]
                                      • # Authenticate with public key file
                                      • Set Variable [ $r; Value:MBS( "SSH.UserAuthPublicKey"; $ssh; SSH::Username; "your key path"; "your key path"; SSH::Password ) ]
                                      • If [ MBS("IsError") ]
                                      • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                      • End If
                                      • End If
                                      • If [ MBS( "SSH.IsAuthenticated"; $ssh ) ≠ 1 ]
                                      • Show Custom Dialog [ Title: "Authentication"; Message: "no authenticated. Supported ways: " & $authuserlist; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                      • Else
                                      • # Start a new channel
                                      • Set Variable [ $r; Value:MBS( "SSH.OpenSession"; $ssh ) ]
                                      • If [ MBS("IsError") ]
                                      • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                      • Else
                                      • # Execute a command
                                      • Set Variable [ $r; Value:MBS( "SSH.Execute"; $ssh; SSH::Command ) ]
                                      • If [ MBS("IsError") ]
                                      • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                      • Else
                                      • # We read text in several chunks until no new text is coming any more:
                                      • Set Variable [ $text; Value:"" ]
                                      • Loop
                                      • Pause/Resume Script [ Duration (seconds): ,1 ]
                                      • # Read some text:
                                      • Set Variable [ $newtext; Value:MBS( "SSH.ReadText"; $ssh; 10000; "UTF8" ) ]
                                      • If [ MBS("iserror") = 0 ]
                                      • If [ Length($newText) > 0 ]
                                      • Set Variable [ $text; Value:$text & $newText ]
                                      • End If
                                      • Exit Loop If [ Length($newText) = 0 ]
                                      • End If
                                      • End Loop
                                      • Set Field [ SSH::Result; $text ]
                                      • End If
                                      • End If
                                      • # Close channel
                                      • Set Variable [ $r; Value:MBS( "SSH.CloseChannel"; $ssh ) ]
                                      • # Disconnect
                                      • Set Variable [ $r; Value:MBS( "SSH.Disconnect"; $ssh ) ]
                                      • End If
                                      • End If
                                      • End If
                                      • # Release memory.
                                      • Set Variable [ $r; Value:MBS( "SSH.Release"; $ssh ) ]
                                      Fields used in this script
                                      Scripts used in this script
                                        Layouts used in this script
                                          Tables used in this script
                                          Table occurrences used by this script
                                          Custom Functions used by this script
                                            Custom menu set used by this script

                                              Previous Script: [Run]
                                              Script NameClear
                                              Run script with full access privilegesOff
                                              Include In MenuYes
                                              Layouts that use this script
                                                Scripts that use this script
                                                  Script Definition
                                                  Script Steps
                                                  • Go to Record/Request/Page [ First ]
                                                  • Loop
                                                  • Set Field [ SSH::HostKeyHash; "" ]
                                                  • Set Field [ SSH::UserAuthList; "" ]
                                                  • Set Field [ SSH::Result; "" ]
                                                  • Go to Record/Request/Page [ Next; Exit after last ]
                                                  • End Loop
                                                  • Go to Record/Request/Page [ First ]
                                                  Fields used in this script
                                                  Scripts used in this script
                                                    Layouts used in this script
                                                      Tables used in this script
                                                      Table occurrences used by this script
                                                      Custom Functions used by this script
                                                        Custom menu set used by this script

                                                          Download example: SSH

                                                          Used functions: