Closed Thread
Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 70

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

  1. #11
    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 you suggestions ikonia.

    I have no idea how the .csv file is stuctured. Once he has given me the .csv file, I'll post an [edited] copy of it here.

    ikonia: The 2nd method you mentioned, how would I put the name in the /out: parameter, automatically?

    Also, speed doesn't matter. Even if it takes 24 hours to complete, well whatever.

    I'll try and get the .csv file again, sorry for the wait.

    Panarchy

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #12
    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

    CSV - Comma-delimited text file. Basically one record per line, fields are separated by commas. You could use a printf() call for the /OUT: parameter.

  4. #13
    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, though I would still like everyone to get a look at the CSV file, to confirm that what you've been suggesting is possible.

    Supposing it's something like;

    255.255.255.255, Panarchy
    124.323.125.235, SandMan
    ...

    Could you please give me an example of how the code to input the data into the .cpp file, then compile it with the name look?

    Thanks in advance,

    Panarchy

  5. #14
    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

    Same thing. You put a token in the template CPP file that doesn't appear anywhere else, then you do a string replace.

  6. #15
    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

    Can I do a per-line replacement?

    As I'm thinking that would be better... I can put the IP Address on a line of it's own.

    Also, could I please have an example of how the end-code should look?

    Thanks in advance,

    Panarchy

  7. #16
    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

    No need to. Prepare to be amazed by the power of Perl.

    Code:
    #!/usr/bin/env perl
    
    use strict;
    
    my (@iplist,@template,$currip,@outln) = ((),(),'','')
    
    #fill iplist with ip's here
    
    #open template file
    open(CPPTEMPLATE,"<cpptemplate.cpp") or die "Failed to open template file.";
    
    #load entire file into array
    @template = <CPPTEMPLATE>;
    
    #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 for writing.";
    	#for every line in the template file...
    	foreach(@template)
    	{
    		#replace all occurrences of __PUTIPHERE__ with the current ip
    		$outln =~ /__PUTIPHERE__/$currip/g;
    		#write it out to the output file
    		print CPPOUT $outln
    	}
    	#close the output file
    	close(CPPOUT);
    }
    
    #close template file
    close(CPPTEMPLATE);
    
    #exit
    0;
    sudo rm -rf /

  8. #17
    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

    now that's some tidy perl, slick

  9. #18
    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

    *insert applause emoticon here*

    Thanks dargueta. To mix good news with good news, I received the .csv file today!



    Two quick questions;
    1. How do I concatenate the .csv file into the Perl script? You did declare @iplist, however I don't understand how you'd like it sorted. Also, the names...
    2. The compiler options/commands, where do they fit in?
      Code:
      cl /clr "super.cpp"
      link super-resouce.res main.obj /out:"%name%".exe
    Your code is beautiful. Please use your talent to add the missing capabilities listed above.

    Thanks once again,

    Panarchy

  10. #19
    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

    Post the CSV so I can see what the fields are like, then I'll write it up tonight. Should take me all of five minutes, I think.
    sudo rm -rf /

  11. #20
    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

    Excellent, I'll be looking forward to the end product.

    Book1.csv

    Also, unsure of why I am yet to post it, but here are the project files for the VNC Authentication;

    Code::Blocks project: VNC.zip

    Visual Studio 2008 project: VNC.zip

    Thanks for all your help, will be looking forward to tonight [in your timezone!]

    Panarchy
    Last edited by Panarchy; 06-09-2009 at 06:42 PM.

Closed Thread
Page 2 of 7 FirstFirst 1234 ... 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