473,700 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to invoke external progrmme and capture its output

1 New Member
Hi all,
I am using an external binary to view memory starting from a specific address and i want to automate this via perl however there are problems. Hope you can help me ..thx

The output of the programme is like below:
Expand|Select|Wrap|Line Numbers
  1. bash-3.2$ mem_disp 12B21D20 100
  2. Opening RO Data Memory File scp.ro
  3. Opening Memory File CP2.16.0000000c.18.pmd.raw
  4. 12B21D20 12B6E500 186CAF00 12D81A00 00000010 *.....l..........*
  5. 12B21D30 000000AA 01060009 00000088 00000000 *................*
  6. 12B21D40 F05500FF 00019E02 00030000 00047849 *.U............xI*
  7. 12B21D50 0001013F 0001012F 805A0022 00593FC1 *...?.../.Z.".Y?.*
  8. 12B21D60 A5020000 480E05ED 00010000 00900058 *....H..........X*
  9. 12B21D70 00000000 00000000 00000000 00000000 *................*
  10. 12B21D80 43616C6C 50726F63 00000000 00000000 *CallProc........*
  11. 12B21D90 00000000 00000000 43616C6C 50726F63 *........CallProc*
  12. 12B21DA0 5F537663 5F534259 00000000 00000000 *_Svc_SBY........*
I have around 30K of addresses which i want to send each to the programme above and split & save in a seperate log file ..i firstly tried to verify that programme executes and run properly for just 1 address in the list, however i can`t see all the output ( see just 1 line) when i run the perl script below:
=============== =============== =============== ===============
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. open (FILE, 'addr.txt');
  3. foreach my $line (<FILE>){
  4. $command = `mem_disp $line 80`;
  5. print "$command";
  6. }
  7. close (FILE);
=============== =============== =============== =============== =
This gives the following output:
Expand|Select|Wrap|Line Numbers
  1. bash-3.2$ split.pl 
  2. Name "main::command" used only once: possible typo at ./split.pl line 5.
  3. sh: line 1: 80: command not found
  4. bash-3.2$ split.pl 
  5. sh: line 1: 80: command not found
  6. Opening RO Data Memory File scp.ro
  7. Opening Memory File CP2.16.0000000c.18.pmd.raw
  8.  
  9. 12B21D20 12B6E500 *.... *
-------------------------------------------------------------------
Aug 3 '12 #1
1 1680
numberwhun
3,509 Recognized Expert Moderator Specialist
That looks to be an error from the running of the command on line 4. If I were you I would drop into the shell and execute the command the way that the script is and ensure that it works the way that you expect.

Regards,

Jeff
Aug 6 '12 #2

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

Similar topics

3
11622
by: konsu | last post by:
hello, when a web request comes to my index.php, i would like index.php to execute a php script stored in an external file and capture the external script's output to a variable. i am doing this because the external script can read the database and can emit xml that i want to use. index.php (or whatever) wants to grab this xml and pass it through an xslt.
1
3815
by: Pawel Banys | last post by:
Hello, There is an operation which can be performed at the shell prompt the following way: some_prg > result_file However, before "some_prg" can use files, they have to be converted and it can be done like this:
2
1486
by: lkr | last post by:
how to capture java output from cammand line agrument using c#
1
1598
by: Anoj Kumar | last post by:
Hi Guys! How to capture output of a console based program and display it on Windows Forms applcation. Thx Anoj Kumar
4
8924
by: Peter A. Schott | last post by:
Not sure what I should do here. I know that DOS/CMD can capture the output of EXE files in Win32. I know that os.popen() has been recommended for this, but the couple of times I've tried, it didn't seem to work well. I haven't had a lot of need to do this recently, but we're trying to automate some processes right now that require us to trap the output of a command line and react accordingly. Any suggestions on the best method for...
1
3582
by: sandy | last post by:
Hi, I am trying to invoke an external email management program from my ASP.NET web application. For testing purposes I created a very simple webform that has a single button. The code behind has the following: Sub btnGo_Click(ByVal sender as System.Object, ByVal e as System.EventArgs) Handles btnGo.Click
6
16936
by: niskin | last post by:
I am running a system command and I need to capture the output so that, if the command has done what it is meant to, the program does something different. If I do this: int i; i=system("cd C:\\Dave\\C-programming\\Password Cracker\\ & ftp -s:ftpscript.txt ftp.collateraldesign.co.uk"); printf ("The value returned was: %d.\n",i); The value returned is 0. However, I want to know if there was an error logging on, how can I know whether the...
8
3562
by: grikdog | last post by:
How to I capture stdout output from a system call and pipe it back into my running script? system "echo foobar"; # how to continue here with "foobar" in stdin ?? ... I can fake it with pipes and additional scripts, but that seems like overkill.
10
17696
by: lalnamar | last post by:
I want to execute a unix time command using perl, and capture the output (specifically, the time it takes the command to execute). i tried using the system command: system("time command "); however, when i try to capture the output, the capture output does not contain the amount of time it took to execute when i try to do: $var = `time command `; there is the same problem (the ouput from the command is saved in the variable; however,...
5
1736
by: goje | last post by:
Hello I want to capture the Output of the External Console Application in my application and also want to send commands to External Console Application from my application. Someone have some code for me? Please....Help me Goje
0
8713
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8639
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7795
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4650
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2379
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.