The example is here, and I tried it by changing the filter to tcp and dst port 80 and the following:
void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
....
ip_len = (ih->ver_ihl & 0xf) * 4;
tcp_len = (((u_char*)ih)[ip_len + 12] >> 4) * 4;
tcpPayload = (u_char*)ih + ip_len + tc...
I have heard of WINE but I don't like it because it's slow on the computers I have tested and almost always crashes. It also has some unpleasant looking gui.
I am wondering if there is a "win32" library in c/c++ for linux that produces native linux code
so that if I have my source code for windows, I can just recompile and produce a work...
Hi guys,
I need to count the similar elements in an array. For example, if i have an array,
array[0,0,0,1,2,3,3].The number of 0's are 3 , no. of 1's are 1 , no. of 2's are 1 , no. of 3's are 2 in this array . I am sorry if this message has been posted before. Help is appreciated. Thanks in advance.
Regards,
THM
P.S : Language is C/C...
does it use setlocale()?
does it assume utf-8 for all input strings when in a UTF-8 locale?
I understand what unicode is and how it is related to utf-8, but how does one "convert to it" internally with all their strings?
How does it convert all input strings to UTF-8? Does it use a C library function?
Does the current working locale...
I have the following code to copy files
sprintf(command, "copy /Y %s %s", sourceFile, targetFile);
system(command);
It works except for the dos window showing up which is very annoying.
I am trying to use CreateProcess() (with an #ifdef for WINNT), but not sure how to setup the command line for the same.
Any other options for copying...
Consider this code:
char *strs[] = { "string1", "string2", NULL };
char *ptr1 = NULL, *ptr2 = NULL, *tmp;
short iter = 0;
tmp = ptr1;
while (iter < 2)
{
tmp = strdup(strs[iter]);
tmp = ptr2;
iter++;
}
printf("1: %s\n2: %s\n", ptr1, ptr2);
I want this to output "string1\nstring2\n" however str1 and str2 remain null. What am ...
Hi there. Recently, I found a problem with Visual C++ 2008 compiler, but using minor hack avoid it. Currently, I cannot use the same hack, but problem exists as in 2008 as in 2010 (Express).
So, I've prepared for you 2 simple C file: one for DLL, one for program:
DLL (file-dll.c):
#include <stdio.h>
__declspec(dllexport) void
print_t...
Hi,
I have to create a software that will scan several directories and extracts information about the executables found.
I need to do two things:
Determine if a given file is an executable (.exe, .dll, and so on) - Checking the extension is probably not good enough.
Get the information about this executable (the company name, the pro...
Hello,
I have a need to access the encryption (cipher, write) keys that are generated from the master key that is generated from the OpenSSL C API. I know I can access the master key using the SSL struct as follows:
ssl->session->master_key
Unfortunately looking at the OpenSSL code has not gotten me very far as the API is not very ...
I'm not sure how to go about figuring out how to map texture cooridnates for a 2D NGon (N sided polygon) How can this be done?
The effect i'm trying to achieve is for the texture to fit on the polygon and stretch out accordingly so the whole texture fits on it.
Thanks
...
I have a problem that requires me to calculate the maximum upload and download available, then limit my program's usage to a percentage of it. However, I can't think of a good way to find the maximums.
At the moment, the only solution I can come up with is transfering a few megabytes between the client and server, then measuring how lin...
i tried to take input from user
input type is not determined(can be char or int)
i wanna take input and store in pointer array
while i doing that job forr each pointer i wanna take place from leap area
that is using malloc
but below code doesnot work why???
int main(void)
{
char *tutar[100][20],temp;
...
Getting back in to some C work.
Many of my functions look like this:
int err = do_something(arg1, arg2, arg3, &result);
With the intent the result gets populated by the function, and the return value is the status of the call.
The darkside is you get something naive like this:
int err = func1(...);
if (!err) {
err = func2(...);...
Suppose I am editing a buffer containing C code.
I have started semantic with semantic-load-enable-code-helpers .
I have point placed on the name of a function . If I then invoke senator-jump I can jump to the place where that fn is first declared, in that module. If there is an extern declaration in that module, then it goes to tha...
hello folks,
I am following this EBook about Ethical Hacking, and I reached the Linux Exploit Chapter, this is the code with Aleph's 1 code.
//shellcode.c
char shellcode[] = //setuid(0) & Aleph1's famous shellcode, see ref.
"\x31\xc0\x31\xdb\xb0\x17\xcd\x80" //setuid(0) first
"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\...
Pay attentions that there is a space in it.
Which function can I use?
...
/^[^\s]+\s([^\s]+)\s/
In PHP,I can use regex to get the substr by $1,
how should I do it in C?
It's better if can do it without regex,though.
UPDATE
Put simply, how do I get werwerur out of swerwer werwerur y (the second)?
...
Hello,
I am writing an application involving user input from the keyboard. For doing it I use this way of reading the input:
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
int mygetch( ) {
struct termios oldt,
newt;
int ch;
tcgetattr( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &...
The connection is as follows An infrared sensor circuit which yields 0 or 5v depending on closed or open circuit output line to port 2_0 pin of microcontroller 8051 philips.Problem is when i do this the circuit value are overridden by the current value on port 2_0 led always goes on.Here is my code(in keil c) i guess i have ...
How to make it behave like a prompt,
say,if too much text overflows the buffer limit,the previous should be overwritten.
Is it possible for gtk_text_view?
...