# # setup path and load IxLoad package # source ../setup_simple.tcl # # Initialize IxLoad # #----------------------------------------------------------------------- # Connect #----------------------------------------------------------------------- # IxLoad onnect should always be called, even for local scripts ::IxLoad connect $::IxLoadPrivate::SimpleSettings::remoteServer # once we've connected, make sure we disconnect, even if there's a problem if [catch { # Loads plugins for specific protocols configured in this test # global ixAppPluginManager $ixAppPluginManager load "nessus" # setup logger set logtag "IxLoad-api" set logName "simplevulnerabilityattacksclient" set logger [::IxLoad new ixLogger $logtag 1] set logEngine [$logger getEngine] $logEngine setLevels $::ixLogger(kLevelDebug) $::ixLogger(kLevelInfo) $logEngine setFile $logName 2 256 1 #----------------------------------------------------------------------- # Build Chassis Chain #----------------------------------------------------------------------- set chassisChain [::IxLoad new ixChassisChain] $chassisChain addChassis $::IxLoadPrivate::SimpleSettings::chassisName #----------------------------------------------------------------------- # Build client and server Network #----------------------------------------------------------------------- set clnt_network [::IxLoad new ixClientNetwork $chassisChain] $clnt_network config -name "clnt_network" $clnt_network networkRangeList.appendItem \ -name "clnt_range" \ -enable 1 \ -firstIp "198.18.0.1" \ -ipIncrStep $::ixNetworkRange(kIpIncrOctetForth) \ -ipCount 100 \ -networkMask "255.255.0.0" \ -gateway "0.0.0.0" \ -firstMac "00:C6:12:02:01:00" \ -macIncrStep $::ixNetworkRange(kMacIncrOctetSixth) \ -vlanEnable 0 \ -vlanId 1 \ -mssEnable 0 \ -mss 100 $clnt_network portList.appendItem \ -chassisId 1 \ -cardId $::IxLoadPrivate::SimpleSettings::clientPort(CARD_ID)\ -portId $::IxLoadPrivate::SimpleSettings::clientPort(PORT_ID) #----------------------------------------------------------------------- # Construct Client Traffic #----------------------------------------------------------------------- set expected "clnt_traffic" set clnt_traffic [::IxLoad new ixClientTraffic -name $expected] $clnt_traffic agentList.appendItem \ -name "my_attacks_client" \ -protocol "nessus" \ -type "Client" # please Look at the following section. $clnt_traffic agentList(0).pm.targets.appendItem \ -id "TargetHost" \ -destinationHost "198.18.0.101" $clnt_traffic agentList(0).pm.attackSelection.selectedAttacksTable.appendItem \ -attackSelected 1 \ -attackID 14259 \ -attackName "Nmap (NASL wrapper)" #----------------------------------------------------------------------- # Create a client mapping and bind into the # network and traffic that they will be employing #----------------------------------------------------------------------- set clnt_t_n_mapping [::IxLoad new ixClientTrafficNetworkMapping \ -network $clnt_network \ -traffic $clnt_traffic \ -objectiveType $::ixObjective(kObjectiveTypeSimulatedUsers) \ -objectiveValue 1 \ -rampUpValue 1 \ -sustainTime 60 \ -rampDownTime 20 ] #----------------------------------------------------------------------- # Create the test and bind in the network-traffic mapping it is going # to employ. #----------------------------------------------------------------------- set test [::IxLoad new ixTest \ -name "my_test" \ -statsRequired 1 \ -enableResetPorts 0 \ -enableForceOwnership 1 \ ] $test clientCommunityList.appendItem -object $clnt_t_n_mapping #----------------------------------------------------------------------- # Create a test controller bound to the previosuly allocated # chassis chain. This will eventually run the test we created earlier. #----------------------------------------------------------------------- set testController [::IxLoad new ixTestController -outputDir 1] $testController setResultDir "RESULTS/simpleVulnerabilityAttacksClient" $testController run $test vwait ::ixTestControllerMonitor puts $::ixTestControllerMonitor #----------------------------------------------------------------------- # Cleanup #----------------------------------------------------------------------- $testController releaseConfigWaitFinish ::IxLoad delete $logger ::IxLoad delete $logEngine ::IxLoad delete $chassisChain ::IxLoad delete $clnt_network ::IxLoad delete $clnt_traffic ::IxLoad delete $clnt_t_n_mapping ::IxLoad delete $test ::IxLoad delete $testController #----------------------------------------------------------------------- # Disconnect #----------------------------------------------------------------------- }] { puts $errorInfo } # # Disconnect/Release application lock # ::IxLoad disconnect