SunQuest
           C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #16  
Old April 29th, 2008, 12:56 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is online now
Contributing User
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 3,793 dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Month 6 h 53 m 57 sec
Reputation Power: 434
Uh, system() requires the null. Removing it would mess everything up.

Are you trying to plunk the variable name into the string that you're passing to system? If so, then what do you think that you're trying to accomplish? Despite perl's C'ishness, C isn't perl -- you don't insert a variable's value simply by plopping it into a double-quoted string (BTW, single quotes vs double quotes is an entirely different kind of issue in C than in perl and shell scripting).

system() receives a single string. Period. If you need to insert variable values into that string, then you need to do that as you build the string before making the system call. For example:
Code:
    sprintf(mail_str,"mail %s",email);
    system(mail_str);

or
Code:
    strcpy(mail_str,"mail ");
    strcat(mail_str, email);
    system(mail_str);

Last edited by dwise1_aol : April 29th, 2008 at 01:01 PM.

Reply With Quote
  #17  
Old April 29th, 2008, 01:01 PM
sizablegrin's Avatar
sizablegrin sizablegrin is offline
Stubborn ol' L'User
Click here for more information.
 
Join Date: Jun 2005
Posts: 3,036 sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 23 h 52 m 33 sec
Reputation Power: 1440
@AnarCom: Your problem is that the command,
system ("mail email");
results in a command of mail email. In other words, the email variable is not expanded into the actual address. It's just the word, email.

Build your command, then pass it to system. Something like this:

Code:
cmd = "mail ";
strcpy (cmd, email);
system (cmd);
Comments on this post
dwise1_aol disagrees: Coding from the hip, it's easy to miss the target. Best revisit that code snippet.
The Architect agrees: Right on the ball
__________________
C/C++ pointers (Original in the "Commonly Asked Questions" thread).

Reply With Quote
  #18  
Old April 29th, 2008, 01:27 PM
sizablegrin's Avatar
sizablegrin sizablegrin is offline
Stubborn ol' L'User
Click here for more information.
 
Join Date: Jun 2005
Posts: 3,036 sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 23 h 52 m 33 sec
Reputation Power: 1440
You're correct, of course, dwise; that should have been strcpy followed by strcat.

Reply With Quote
  #19  
Old April 29th, 2008, 02:33 PM
clifford's Avatar
clifford clifford is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: UK
Posts: 2,374 clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 23 h 55 m 11 sec
Reputation Power: 306
Quote:
Originally Posted by AnarCom
The problem stands for me too!
No. Yours is an entirely different problem, and this is not your thread. Don't hijack other peoples threads, especially before they are concluded.

Reply With Quote
  #20  
Old April 30th, 2008, 10:00 AM
AnarCom AnarCom is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 AnarCom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 34 sec
Reputation Power: 0
Well, thank you all for the help!

The following works for me:
Code:
    strcpy(mail_str,"mail ");
    strcat(mail_str, email);
    system(mail_str);

I also understood the way system() works and the way strings are read.

Quote:
Originally Posted by clifford
No. Yours is an entirely different problem, and this is not your thread. Don't hijack other peoples threads, especially before they are concluded.

Relax, I thought the problem was with the null. I wasn't borned with integrated C & UNIX white bible...
Comments on this post
clifford disagrees: No, posting to this thread was just rude and inconsiderate.

Reply With Quote
  #21  
Old May 2nd, 2008, 03:50 PM
karl1 karl1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 15 karl1 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 8 m 23 sec
Reputation Power: 0
The only time you need, as far as I know, to remove the null terminator is in shellcoding. Getting rid of the 0x00 is a must.
Comments on this post
sizablegrin disagrees: So just replace it with, say, 'A'???

Reply With Quote
  #22  
Old May 4th, 2008, 03:47 PM
karl1 karl1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 15 karl1 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 8 m 23 sec
Reputation Power: 0
Quote:
Originally Posted by karl1
The only time you need, as far as I know, to remove the null terminator is in shellcoding. Getting rid of the 0x00 is a must.


Replacing it with an 'A' wont work, it really isn't that simple.

Reply With Quote
  #23  
Old May 4th, 2008, 08:23 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is online now
Contributing User
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 3,793 dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Month 6 h 53 m 57 sec
Reputation Power: 434
Quote:
Originally Posted by karl1
Replacing it with an 'A' wont work, it really isn't that simple.


Then an explanation is in order. Starting with a description of what you mean by "shellcoding".

Reply With Quote
  #24  
Old May 4th, 2008, 09:18 PM
sizablegrin's Avatar
sizablegrin sizablegrin is offline
Stubborn ol' L'User
Click here for more information.
 
Join Date: Jun 2005
Posts: 3,036 sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 23 h 52 m 33 sec
Reputation Power: 1440
Actually, he's got it a little mixed up. A shellcode exploit that is designed to be introduced as a string must have no nulls other than at the end. Otherwise the injection would be terminated early. An instruction that carried a literal zero as an operand would be one example. Alternative instructions that create the zero would be required. That's about all I'm willing to say on the subject of shellcode in the forum. Script kiddies can hang in crackerz forums.

Reply With Quote
  #25  
Old May 5th, 2008, 02:12 PM
karl1 karl1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 15 karl1 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 8 m 23 sec
Reputation Power: 0
Quote:
Originally Posted by sizablegrin
Actually, he's got it a little mixed up. A shellcode exploit that is designed to be introduced as a string must have no nulls other than at the end. Otherwise the injection would be terminated early. An instruction that carried a literal zero as an operand would be one example. Alternative instructions that create the zero would be required. That's about all I'm willing to say on the subject of shellcode in the forum. Script kiddies can hang in crackerz forums.


FYI, shellcoding is about as far from being a "script kiddie" as you can possibly get. Show me a script kiddie that can shellcode, and I'll give you my brand new Asus eee 900. Anyway........That was my 1 cent.
Comments on this post
clifford disagrees: All your points are irrelevant to the subject, you are just trying to show off, and we are not
impressed.

Reply With Quote
  #26  
Old May 14th, 2008, 05:02 AM
karl1 karl1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 15 karl1 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 8 m 23 sec
Reputation Power: 0
Coming from you clifford that's really rich - laughable infact.
Comments on this post
etienne141 disagrees: You expected this, didn't you?
sizablegrin disagrees!

Reply With Quote
  #27  
Old May 14th, 2008, 04:18 PM
clifford's Avatar
clifford clifford is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: UK
Posts: 2,374 clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level)clifford User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 23 h 55 m 11 sec
Reputation Power: 306
Quote:
Originally Posted by karl1
Coming from you clifford that's really rich - laughable infact.
Well I don't believe I have made irrelevant points, and if knowing what you are talking about, (or rather only talking about that which you know), is showing off in your opinion, so be it. In time your member rating/post ratio may indicate how much you impress.

Reply With Quote
  #28  
Old May 14th, 2008, 06:08 PM
sizablegrin's Avatar
sizablegrin sizablegrin is offline
Stubborn ol' L'User
Click here for more information.
 
Join Date: Jun 2005
Posts: 3,036 sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level)sizablegrin User rank is General 7th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 23 h 52 m 33 sec
Reputation Power: 1440
Clifford is a REAL contributor. The number is small. You won't need more than two hands, I don't think, to count them. Perhaps you should get real. Get off the sugar-tit. Sheesh.

Reply With Quote
  #29