Linux.com

ThirtySecondNoob

ThirtySecondNoob

  • Linux.com Member
  • Posts: 7
  • Member Since: 30 Sep 10
  • Last Logged In: 27 Oct 10

Latest Posts

Posted by
Topic
Post Preview
Posted
  • ThirtySecondNoob
    RE: Background Programs - & and ENV Var's in PERL
    Hi gomer, What I have been doing is using this ssh command from my last post, ssh -l ec34 -L 12345:127.0.0.1:10237 192.101.77.209 -n to forward my incoming data to a port, and read off this port with: netcat -t localhost 12345 Once I implemented your code after closing the current ssh linkup I had going, the code ran in correctly, but when I tried to netcat it I got this error message - "channel 2: open failed: administratively prohibited: open failed". I'm unsure what exactly your command does, yet, and i'm fairly certain this is possible without admin privileges. Hopefully you can help me out! John
    Link to this post 23 Oct 10

    Hi gomer,

    What I have been doing is using this ssh command from my last post,

    ssh -l ec34 -L 12345:127.0.0.1:10237 192.101.77.209 -n

    to forward my incoming data to a port, and read off this port with:

    netcat -t localhost 12345

    Once I implemented your code after closing the current ssh linkup I had going, the code ran in correctly, but when I tried to netcat it I got this error message - "channel 2: open failed: administratively prohibited: open failed".
    I'm unsure what exactly your command does, yet, and i'm fairly certain this is possible without admin privileges. Hopefully you can help me out!

    John

  • ThirtySecondNoob
    Background Programs - & and ENV Var's in PERL
    Background Programs - & and ENV{} Var's in PERL Hi, I've been recently implementing a program that will access incoming data by forwarding data from an ip address to a local port and gathering that data, using these commands. ssh -l ec34 -L 12345:127.0.0.1:10237 192.101.77.209 -n Unfortunately this command takes up the command line, and when i add a '&' to it, I get the error: Pseudo-terminal will not be allocated because stdin is not a terminal. A wise friend of mine suggested looking into Environment Variables and modify one. I used the code: foreach $key (sort keys(%ENV)) { print "$key = $ENV{$key}

    n"; } To display these variables, but found nothing I felt I could use against this error. I'm thinking I may be missing a parameter in the `ssh...` command once I have added an ampersand & to it, or I have now confused it into thinking it's going to output into standard in (possibly as a default for the background), and I dont know why. Does anyone know how I can connect this data to a local port behind the scenes?

    Link to this post 15 Oct 10

    Background Programs - & and ENV{} Var's in PERL
    Hi, I've been recently implementing a program that will access incoming data by forwarding data from an ip address to a local port and gathering that data, using these commands.

    ssh -l ec34 -L 12345:127.0.0.1:10237 192.101.77.209 -n

    Unfortunately this command takes up the command line, and when i add a '&' to it, I get the error:

    Pseudo-terminal will not be allocated because stdin is not a terminal.

    A wise friend of mine suggested looking into Environment Variables and modify one. I used the code:

    foreach $key (sort keys(%ENV)) {
    print "$key = $ENV{$key}<p>n";
    }

    To display these variables, but found nothing I felt I could use against this error. I'm thinking I may be missing a parameter in the `ssh...` command once I have added an ampersand & to it, or I have now confused it into thinking it's going to output into standard in (possibly as a default for the background), and I dont know why. Does anyone know how I can connect this data to a local port behind the scenes?

  • ThirtySecondNoob
    RE: REPOSTED in Linux Applications
    Thanks. I'll re-post this thread there, and get rid of this one.
    Link to this post 15 Oct 10

    Thanks. I'll re-post this thread there, and get rid of this one.

  • ThirtySecondNoob
    REPOSTED in Linux Applications
    Hi, I've been recently implementing a program that will access incoming data by forwarding data from an ip address to a local port and gathering that data, using these commands. ssh -l ec34 -L 12345:127.0.0.1:10237 192.101.77.209 -n Unfortunately this command takes up the command line, and when i add a '&' to it, I get the error: Pseudo-terminal will not be allocated because stdin is not a terminal. A wise friend of mine suggested looking into Environment Variables and modify one. I used the code: foreach $key (sort keys(%ENV)) { print "$key = $ENV{$key}

    \n"; } To display these variables, but found nothing I felt I could use against this error. I'm thinking I may be missing a parameter in the `ssh...` command once I have added an ampersand & to it, or I have now confused it into thinking it's going to output into standard in (possibly as a default for the background), and I dont know why. Does anyone know how I can connect this data to a local port behind the scenes?

    Link to this post 14 Oct 10

    Hi, I've been recently implementing a program that will access incoming data by forwarding data from an ip address to a local port and gathering that data, using these commands.

    ssh -l ec34 -L 12345:127.0.0.1:10237 192.101.77.209 -n

    Unfortunately this command takes up the command line, and when i add a '&' to it, I get the error:

    Pseudo-terminal will not be allocated because stdin is not a terminal.

    A wise friend of mine suggested looking into Environment Variables and modify one. I used the code:

    foreach $key (sort keys(%ENV)) {
    print "$key = $ENV{$key}<p>\n";
    }

    To display these variables, but found nothing I felt I could use against this error. I'm thinking I may be missing a parameter in the `ssh...` command once I have added an ampersand & to it, or I have now confused it into thinking it's going to output into standard in (possibly as a default for the background), and I dont know why. Does anyone know how I can connect this data to a local port behind the scenes?

  • ThirtySecondNoob
    RE: Using Shell code in Perl - `Backticks`
    Beautiful, thank you so much for your help. It works!
    Link to this post 02 Oct 10

    Beautiful, thank you so much for your help. It works!

  • ThirtySecondNoob
    RE: Using Shell code in Perl - `Backticks`
    Hi gomer, I have the simplest code I could wish for in this reply here. I am thinking that this is the code I want, for with I had used "netcat localhost 12345". The recieve (recv SOCKET,SCALAR,LENGTH,FLAGS) function I am thinking is the one I want, although the description for its FLAGS is too vague - "Takes the same flags as the system call of the same name. " My -f is just a guess for a proper flag, but i cannot disclude any flags for they are a mandatory parameter. I have included my code's test case below. When I ran this program, I expected when a line went through the data feed, it would be printed on the screen. I tested this with a separate shell and it was not the case. Do you have any ideas on what I might be doing wrong? ### use IO::Socket::INET; $sock = IO::Socket::INET->new(Listen => 1, #queue size for listen LocalAddr => 'localhost', LocalPort => 12345, Proto => 'tcp'); while(1) { my $new_line; recv($sock, $new_line, 200, -f); if (!$new_line) {next;} print $new_line."\n"; } ###
    Link to this post 01 Oct 10

    Hi gomer,

    I have the simplest code I could wish for in this reply here. I am thinking that this is the code I want, for with I had used "netcat localhost 12345". The recieve (recv SOCKET,SCALAR,LENGTH,FLAGS) function I am thinking is the one I want, although the description for its FLAGS is too vague - "Takes the same flags as the system call of the same name. "
    My -f is just a guess for a proper flag, but i cannot disclude any flags for they are a mandatory parameter.

    I have included my code's test case below. When I ran this program, I expected when a line went through the data feed, it would be printed on the screen. I tested this with a separate shell and it was not the case. Do you have any ideas on what I might be doing wrong?

    ###
    use IO::Socket::INET;

    $sock = IO::Socket::INET->new(Listen => 1, #queue size for listen
    LocalAddr => 'localhost',
    LocalPort => 12345,
    Proto => 'tcp');


    while(1)
    {

    my $new_line;

    recv($sock, $new_line, 200, -f);

    if (!$new_line) {next;}

    print $new_line."\n";

    }
    ###

  • ThirtySecondNoob
    Using Shell code in Perl - `Backticks`
    HI all. First time poster here, so please bear with me. I have a real time data feed that I'm pulling data off of into a local port. The command I use to grab the data is "netcat localhost 12345". This command works perfectly in the shell command line. The problem is that it runs continuously. To have it run only for 100 ms would be perfect. In the Perl Script I am implementing this command with, my goal is to put each line into a string so I can parse the data, filter if need be, and do it again as a loop. The following commands are in a while(1) loop. I tried a number of things to get the data into a string line by line... while(`netcat localhost 12345`) #because I know that backticked system commands return their output to the STDOUT while(!`netcat localhost 12345`) #I thought maybe it worked with negative logic $new_line = `netcat localhost 12345`; #This just didnt work at all... `echo |netcat localhost 12345 >> $new_line`; Unfortunately none have worked. I know that you can netcat the data into a file, but I would like to like to cut out the middle man, if possible. Hopefully someone knows a simple command that can help me.
    Link to this post 01 Oct 10

    HI all. First time poster here, so please bear with me.

    I have a real time data feed that I'm pulling data off of into a local port. The command I use to grab the data is
    "netcat localhost 12345".
    This command works perfectly in the shell command line. The problem is that it runs continuously. To have it run only for 100 ms would be perfect.
    In the Perl Script I am implementing this command with, my goal is to put each line into a string so I can parse the data, filter if need be, and do it again as a loop. The following commands are in a while(1) loop. I tried a number of things to get the data into a string line by line...

    while(`netcat localhost 12345`) #because I know that backticked system commands return their output to the STDOUT

    while(!`netcat localhost 12345`) #I thought maybe it worked with negative logic

    $new_line = `netcat localhost 12345`; #This just didnt work at all...

    `echo |netcat localhost 12345 >> $new_line`;

    Unfortunately none have worked. I know that you can netcat the data into a file, but I would like to like to cut out the middle man, if possible. Hopefully someone knows a simple command that can help me.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board