473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

PowerShell script to run Fortify Scan gives errors

dbrewerton
115 100+
Hello Experts! I am trying to build a script that performs automated scanning using HP Fortify from the command line. I thought I was passing my parameters correctly but something is not quite right. The command prompt script that does this is:

Expand|Select|Wrap|Line Numbers
  1. ECHO prime clean
  2. sourceanalyzer -b prime -clean
  3.  
  4. ECHO prime translate
  5. sourceanalyzer -b prime %1 -debug -verbose -logfile prime.log -Dcom.fortify.sca.Phase0HigherOrder.Languages=python,ruby,javascript 
  6.  
  7. ECHO prime show files
  8. sourceanalyzer -b prime -show-files> files_prime
  9.  
  10. ECHO prime scan
  11. sourceanalyzer -b prime -logfile prime.scan -scan -f prime.fpr 
  12.  
  13. ECHO prime upload to SSC
  14. fortifyclient -url http://Fortify/ssc -authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx uploadFPR -file prime.fpr -project prime-upload -version version-1.0
  15.  
  16.  
The PowerShell commands that should match up are:

Expand|Select|Wrap|Line Numbers
  1. $Appname = "Fortify Command Line Scanner"
  2. $src = "src/**/*.js" 
  3.  
  4. Write-Host $Appname
  5. ForEach ($Item in $args){
  6.  
  7.    $ThePath = $Item
  8.    $ChildPath = Split-Path $ThePath -Leaf
  9.    $ParPath = Split-Path $ThePath -Parent
  10.  
  11.    Write-Host "Processing Application located at $ThePath"
  12.  
  13.    Write-Host "Cleaning"
  14.    sourceanalyzer -b $ChildPath -clean
  15.  
  16.    Write-Host "Translation"
  17.    sourceanalyzer -b $ChildPath $ThePath$src -debug -verbose -logfile + $ChildPath.log -Dcom.fortify.sca.Phase0HigherOrder.Languages=python,ruby,javascript
  18.  
  19.    Write-Host "Show Files"
  20.    sourceanalyzer -b $ChildPath -show-files> + files_$ChildPath
  21.  
  22.    Write-Host "Scanning"
  23.    sourceanalyzer -b $ChildPath -logfile + $ChildPath.scan -scan -f + $ChildPath.fpr
  24.  
  25.    Write-Host "Uploading to SSC"
  26.    fortifyclient -url http://Fortify/ssc -authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx uploadFPR -file $ChildPath.fpr -project $ChildPath -upload -version version-1.0
  27. }
  28.  
When I run the PowerShell command, I get errors. These errors are as follows:

Expand|Select|Wrap|Line Numbers
  1. Translation
  2. sourceanalyzer : [error]: No parameter specified for argument -logfile
  3. At C:\powershell\FortifyCLS.ps1:31 char:4
  4. + sourceanalyzer -b $ChildPath $ThePath$src -debug -verbose -logfile $ChildPath ...
  5. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  6.     + CategoryInfo          : NotSpecified: ([error]: No par...gument -logfile:String) [], RemoteException
  7.     + FullyQualifiedErrorId : NativeCommandError
  8.  
  9. HP Fortify Static Code Analyzer 6.40.0089 (using JVM 1.8.0_45)
  10. HP Fortify Static Code Analyzer 6.40.0089
  11. Copyright (c) 2003-2015 Hewlett Packard Enterprise Development LP
  12.  
  13. For command-line help, type 'sourceanalyzer -h'
  14.  
  15. sourceanalyzer -b sampleOutput C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.40\Samples\basic\sampleOutputsrc/**/*.js -debug -verbose -logfile sampleOutput.log -D
  16. com.fortify.sca.Phase0HigherOrder.Languages=python,ruby,javascript
  17. Show Files
  18. sourceanalyzer : [error]: Unrecognized or invalid command line argument '-show-files>'
  19. At C:\powershell\FortifyCLS.ps1:35 char:4
  20. +    sourceanalyzer -b $ChildPath -show-files> files_$ChildPath
  21. +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22.     + CategoryInfo          : NotSpecified: ([error]: Unreco... '-show-files>':String) [], RemoteException
  23.     + FullyQualifiedErrorId : NativeCommandError
  24.  
  25. HP Fortify Static Code Analyzer 6.40.0089
  26. Copyright (c) 2003-2015 Hewlett Packard Enterprise Development LP
  27.  
  28. For command-line help, type 'sourceanalyzer -h'
  29.  
  30. sourceanalyzer -b sampleOutput -show-files> files_sampleOutput
  31. Scanning
  32. sourceanalyzer : [error]: No parameter specified for argument -logfile
  33. At C:\powershell\prime.ps1:39 char:4
  34. +    sourceanalyzer -b $ChildPath -logfile $ChildPath.scan -scan -f $ChildPath.fpr
  35. +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36.     + CategoryInfo          : NotSpecified: ([error]: No par...gument -logfile:String) [], RemoteException
  37.     + FullyQualifiedErrorId : NativeCommandError
  38.  
When I output the stuff to the screen using Write-Host, the commands look correct and match what works. So what the heck am I doing wrong? I'm including a copy of the script to help with debugging. Thank you!
Attached Files
File Type: txt FortifyCLS.txt (2.2 KB, 459 views)
May 6 '16 #1
0 3216

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Andreas Palm | last post by:
Hi there, I do have a dataset which I use to write a XML file with inline schema. A second application should use a XmlvalidatingReader to read the xml file again. Now I get errors like: The...
1
by: Jonas | last post by:
Hi, I've recently found out that I'm supposed to set the debug attribute of the compilation element in web.config to false in production environments. But when I do so in my ASP.NET application,...
13
by: squash | last post by:
I am a little annoyed at why such a simple program in Perl is causing so much difficulty for python, i.e: $a += 200000 * 140000; print $a;
1
by: Shuaib | last post by:
Hey! I am trying to embedd python into a C programe of mine. But when I try to compile the C code, gcc gives errors like "undefined reference to `Py_Finalize'" and the same kind for all the...
4
by: Franky | last post by:
I have a cpp program that use to compile in C++6 but give a bunch of errors in VS2005 I'm wondering if I need to reference to some library. I'd appreciate any helpful suggestion Even if...
4
by: rukkie | last post by:
Hi, I have some problems with a PHP reference in a <SCRIPTtag, but only with the Internet Explorer, which gives a "Error on page" message in the Status Bar. The code is as follows : <script>...
11
by: moltendorf | last post by:
Hey everyone, as I have been by far pleased with some of the top helpers on this forum, I have decided to send another one your way. Even though I am personally having minimal issues with this...
1
by: SkyuVa | last post by:
IE8 is giving me an Unknown Runtime Error, on the following line. document.getElementById("txtHint").innerHTML=xmlhttp.responseText; Here is the complete function. function showUser(str)...
0
by: coreyfrankel | last post by:
I am looking for a PowerShell routine that will prune logfiles based on the date of my oldest backup. I keep a week of daily backups and wish to run this routine weekly. Also, as I am brand new to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.