Closed Thread
Page 3 of 7 FirstFirst 12345 ... LastLast
Results 21 to 30 of 70

Thread: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

  1. #21
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    Probably not going to happen tonight, something came up. I'll see what I can do.
    sudo rm -rf /

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #22
    Panarchy is offline Programming Professional
    Join Date
    Nov 2007
    Posts
    259
    Rep Power
    0

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    Thanks, appreciate it.

  4. #23
    Panarchy is offline Programming Professional
    Join Date
    Nov 2007
    Posts
    259
    Rep Power
    0

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    Please get back to this first chance you get.

    Thanks in advance,

    Panarchy

  5. #24
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    Haven't tested this, but I think it'll work.

    Code:
    #!/usr/bin/env perl
    
    use strict;
    
    my (@iplist,$template,$currip) = ((),'','');
    
    #open ip list file
    open(IPFILE,"<iplist.csv") or die "Failed to open IP list file.";
    #read all lines into array
    my @ipfile,$i = ((),0);
    @ipfile = <IPFILE>;
    #for each line in the ip file...
    foreach(@ipfile)
    {
    	#strip leading and trailing spaces off the line
    	chomp($_);
    	#use regular expressions to pull the 
    	#ip address from the line. I have to
    	#check to see if the regex will do
    	#what it's supposed to.
    	$iplist[$i] =~ split(/^*,(*)$/,$_);
    	++$i;
    }
    #close ip list file
    close(IPFILE);
    
    #open template file
    open(CPPTEMPLATE,"<cpptemplate.cpp") or die "Failed to open template file.";
    
    #load entire file into single string...
    #undefine end-of-record variable, which is \n by default. this will result
    #in the file being divided up into an array of lines instead of one single
    #string like we want.
    undef $/;
    
    #read the file into $template.
    $template = <CPPTEMPLATE>;
    
    #reset $/ to avoid problems.
    $/ = "\n";
    
    #for each ip address in the list...
    foreach(@iplist)
    {
    	#get the current ip
    	$currip = $_;
    	#open the output file
    	open(CPPOUT,">$currip.cpp") or die "Failed to open $currip.cpp for writing.";
    	#replace all instances of __PUTIPHERE__ in the template file with the
    	#current ip address.
    	$template =~ /__PUTIPHERE__/$currip/g;
    	#print the result to the output file.
    	print CPPOUT $template;
    	#close the output file
    	close(CPPOUT);
    }
    
    #close template file
    close(CPPTEMPLATE);
    
    #exit
    1;
    sudo rm -rf /

  6. #25
    Panarchy is offline Programming Professional
    Join Date
    Nov 2007
    Posts
    259
    Rep Power
    0

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    Thanks for the code.

    Unfortunately, it doesn't work



    Code:
    #!/usr/bin/env perl
    
    use strict;
    
    my (@iplist,$template,$currip) = ((),'','');
    
    #open ip list file
    open(IPFILE,"<iplist.csv") or die "Failed to open IP list file.";
    #read all lines into array
    my @ipfile,$i = ((),0);
    @ipfile = <IPFILE>;
    #for each line in the ip file...
    foreach(@ipfile)
    {
    	#strip leading and trailing spaces off the line
    	chomp($_);
    	#use regular expressions to pull the 
    	#ip address from the line. I have to
    	#check to see if the regex will do
    	#what it's supposed to.
    	$iplist[$i] =~ split(/^*,(*)$/,$_);
    	++$i;
    }
    #close ip list file
    close(IPFILE);
    
    #open template file
    open(CPPTEMPLATE,"<VNC.cpp") or die "Failed to open template file.";
    
    #load entire file into single string...
    #undefine end-of-record variable, which is \n by default. this will result
    #in the file being divided up into an array of lines instead of one single
    #string like we want.
    undef $/;
    
    #read the file into $template.
    $template = VNC.cpp;
    
    #reset $/ to avoid problems.
    $/ = "\n";
    
    #for each ip address in the list...
    foreach(@iplist)
    {
    	#get the current ip
    	$currip = $_;
    	#open the output file
    	open(CPPOUT,">$currip.cpp") or die "Failed to open $currip.cpp for writing.";
    	#replace all instances of __PUTIPHERE__ in the template file with the
    	#current ip address.
    	$template =~ /__PUTIPHERE__/$currip/g;
    	#print the result to the output file.
    	print CPPOUT $template;
    	#close the output file
    	close(CPPOUT);
    }
    
    #close template file
    close(CPPTEMPLATE);
    
    #should the above text 'CPPTEMPLATE' be replaced with VNC.cpp?
    
    #exit
    1;
    Please help me get it to work!

    Thanks in advance,

    Panarchy

  7. #26
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    That would be because I'm an idiot...

    Code:
    #!/usr/bin/env perl
    
    use strict;
    
    my (@iplist,$template,$hostname,$currip) = ((),'','','');
    
    #open ip list file
    open(IPFILE,"<iplist.csv") or die "Failed to open IP list file.";
    #read all lines into array
    my (@ipfile,$i) = ((),0);
    @ipfile = <IPFILE>;
    #for each line in the ip file...
    foreach(@ipfile)
    {
    	#strip leading and trailing spaces off the line
    	chomp($_);
    	#use regular expressions to pull the 
    	#ip address from the line. I have to
    	#check to see if the regex will do
    	#what it's supposed to.
    	($hostname,$iplist[$i]) =~ split(/,/);
    	chomp($iplist[$i]);
    	++$i;
    }
    #close ip list file
    close(IPFILE);
    
    #open template file
    open(CPPTEMPLATE,"<VNC.cpp") or die "Failed to open template file.";
    
    #load entire file into single string...
    #undefine end-of-record variable, which is \n by default. this will result
    #in the file being divided up into an array of lines instead of one single
    #string like we want.
    undef $/;
    
    #read the file into $template.
    $template = VNC.cpp;
    
    #reset $/ to avoid problems.
    $/ = "\n";
    
    #for each ip address in the list...
    foreach(@iplist)
    {
    	#get the current ip
    	$currip = $_;
    	#open the output file
    	open(CPPOUT,">$currip.cpp") or die "Failed to open $currip.cpp for writing.";
    	#replace all instances of __PUTIPHERE__ in the template file with the
    	#current ip address.
    	$template =~ /__PUTIPHERE__/$currip/g;
    	#print the result to the output file.
    	print CPPOUT $template;
    	#close the output file
    	close(CPPOUT);
    }
    
    #close template file
    close(CPPTEMPLATE);
    
    #should the above text 'CPPTEMPLATE' be replaced with VNC.cpp?
    
    #exit
    1;
    sudo rm -rf /

  8. #27
    Panarchy is offline Programming Professional
    Join Date
    Nov 2007
    Posts
    259
    Rep Power
    0

    Post Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    Thanks, however there are still some missing features.

    To be clearer, I have listed them in 4 steps;

    Step 1. Process IP Address from CSV
    Step 2. Process Name from CSV
    Step 3. Input IP Address into VNC.cpp
    Step 4. Compile with Name

    It seems that Step 4 has been left out... please include it.

    To confirm, Step 4 should correspond the following;
    Code:
    cl /clr "super.cpp"
    link super-resource.res main.obj /out:"%name%".exe
    We're almost there... Please help me complete this!

    Thanks in advance,

    Panarchy

  9. #28
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    Dude, I'd love to help, but I have a full-time job. I think the rest is rather straight-forward enough for you to figure out with the Perl tutorials below:

    Starting Perl (Good but out of date)
    PerlTutorial.org (Great for people who already know how to program)
    sudo rm -rf /

  10. #29
    ikonia is offline Newbie
    Join Date
    May 2009
    Posts
    24
    Rep Power
    0

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    you just need to call the compiler with the correct arguments then start the loop again

  11. #30
    Panarchy is offline Programming Professional
    Join Date
    Nov 2007
    Posts
    259
    Rep Power
    0

    Re: HELP: Script to gather IP Address from .RDP then compile to .exe for VNC

    Dargueta: As do I!

    Well, I'll read through the tutorial, and come back here if I need more help.

    Once I've worked it out, I'll post the completed code here.

    Thanks for your help Dargueta,

    Panarchy

Closed Thread
Page 3 of 7 FirstFirst 12345 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 04-30-2011, 04:12 PM
  2. [HELP] convert Perl script to Bash shell script
    By Egypte in forum Linux Programming and Scripting
    Replies: 2
    Last Post: 04-24-2011, 05:37 PM
  3. Can't Compile
    By tedmp0816 in forum C and C++
    Replies: 4
    Last Post: 10-20-2009, 01:00 AM
  4. PHP: Gather ALL Post Variables
    By phpforfun in forum PHP Development
    Replies: 7
    Last Post: 01-30-2009, 02:34 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts