Sponsored Content
Full Discussion: Port flow capture
Homework and Emergencies Emergency UNIX and Linux Support Port flow capture Post 302943623 by otheus on Monday 11th of May 2015 07:29:16 AM
Old 05-11-2015
Traditionally, you must specify a device. Therefore

Code:
tcpdump -i eth0 -w /tmp/syn.pcap 'tcp[tcpflags] & (tcp-syn) != 0'

But that assumes you want it from eth0. Maybe you want it from wlan0. But maybe your system currently has no interfaces that are up. That would explain why you're not seeing any tcp packets and are resorting to tcpdump in the first place.

Also, the output will be to that file so you won't know it's working right away. Try it without -w... until you get some output.
 

9 More Discussions You Might Find Interesting

1. Cybersecurity

Flow of Unix System

Hello, Is there a functional flow of the UNIX security system that I can view? (1 Reply)
Discussion started by: spanglerbrod
1 Replies

2. Programming

dilemma in control flow

hello im facing a queer problem when i execute the foll code in unix # include <stdio.h> # include <unistd.h> main(int argc,char *argv) { FILE *fp = fopen("/ras/chirag/fifotest/file.fifo","a"); int i=1; fprintf(fp,argv); printf("I SLEEP"); system("date"); for (i=0;i<50;i++)... (2 Replies)
Discussion started by: tej.buch
2 Replies

3. Programming

Flow Chart

Any One help how to draw the flow chart for C programe ? If any usefull link's. (1 Reply)
Discussion started by: sabari
1 Replies

4. Programming

buffer over flow detected

Hi, my program stops with a buffer overflow error, but i can't understand the problem. I have a file like: int array; //global variable void func(){ int i; for(i=0;i<n;i++)array=-1; ... } I had the error when i added the array initialization. the file is a part of a C project. What... (1 Reply)
Discussion started by: littleboyblu
1 Replies

5. Shell Programming and Scripting

Understanding Logic and Flow better

i am in an epic quagmire of horrid misunderstanding. its been a while since ive been in the scene, couldnt remember my login for the account i used to have here, so excuse the 1st post. i dont want it to seem like ima post n boogy. in any case here we go: just recently installed mandriva... (6 Replies)
Discussion started by: SirDonkeyPunch
6 Replies

6. IP Networking

Creating a printer emulator to capture PDL/PCL data coming in on port 9100.

I have a number of Windows CE operator terminals. They have facility to print alarms/messages to ... aser or Inkjet (so they're using PCL). USB or IP. IP connection takes just the IP address. Question How could I create a service or daemon on a server to capture all this data?... (7 Replies)
Discussion started by: transistor
7 Replies

7. Shell Programming and Scripting

Flow Control in CSH

hi , I am new to scripting, i have a doubt can any one pls solve it for me the code is not working set users = (user1 user2 user3) echo The users are echo $users echo Enter the USER NAME set USER_NAME = $< set i = 1; for ( i = 1; i <= $#users; i++ ) if ( $USER_NAME == $users )... (1 Reply)
Discussion started by: Manju87
1 Replies

8. Shell Programming and Scripting

Will this flow work

B() { } A() { calling a function B } for condition do calling a function A done Shall after executing function B, the control will return back to loop? Thanks in advance :) (2 Replies)
Discussion started by: ezee
2 Replies

9. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies
knockd(1)																 knockd(1)

NAME
knockd - port-knock server SYNOPSIS
knockd [options] DESCRIPTION
knockd is a port-knock server. It listens to all traffic on an ethernet (or PPP) interface, looking for special "knock" sequences of port- hits. A client makes these port-hits by sending a TCP (or UDP) packet to a port on the server. This port need not be open -- since knockd listens at the link-layer level, it sees all traffic even if it's destined for a closed port. When the server detects a specific sequence of port-hits, it runs a command defined in its configuration file. This can be used to open up holes in a firewall for quick access. COMMANDLINE OPTIONS
-i, --interface <int> Specify an interface to listen on. The default is eth0. -d, --daemon Become a daemon. This is usually desired for normal server-like operation. -c, --config <file> Specify an alternate location for the config file. Default is /etc/knockd.conf. -D, --debug Ouput debugging messages. -l, --lookup Lookup DNS names for log entries. This may be a security risk! See section SECURITY NOTES. -v, --verbose Output verbose status messages. -V, --version Display the version. -h, --help Syntax help. CONFIGURATION
knockd reads all knock/event sets from a configuration file. Each knock/event begins with a title marker, in the form [name], where name is the name of the event that will appear in the log. A special marker, [options], is used to define global options. Example #1: This example uses two knocks. The first will allow the knocker to access port 22 (SSH), and the second will close the port when the knocker is complete. As you can see, this could be useful if you run a very restrictive (DENY policy) firewall and would like to access it discreetly. [options] logfile = /var/log/knockd.log [openSSH] sequence = 7000,8000,9000 seq_timeout = 10 tcpflags = syn command = /usr/sbin/iptables -A INPUT -s %IP% -j ACCEPT [closeSSH] sequence = 9000,8000,7000 seq_timeout = 10 tcpflags = syn command = /usr/sbin/iptables -D INPUT -s %IP% -j ACCEPT Example #2: This example uses a single knock to control access to port 22 (SSH). After receiving a successful knock, the daemon will run the start_command, wait for the time specified in cmd_timeout, then execute the stop_command. This is useful to automatically close the door behind a knocker. The knock sequence uses both UDP and TCP ports. [options] logfile = /var/log/knockd.log [opencloseSSH] sequence = 2222:udp,3333:tcp,4444:udp seq_timeout = 15 tcpflags = syn,ack start_command = /usr/sbin/iptables -A INPUT -s %IP% -p tcp --syn -j ACCEPT cmd_timeout = 5 stop_command = /usr/sbin/iptables -D INPUT -s %IP% -p tcp --syn -j ACCEPT Example #3: This example doesn't use a single, fixed knock sequence to trigger an event, but a set of sequences taken from a sequence file (one time sequences), specified by the one_time_sequences directive. After each successful knock, the used sequence will be invalidated and the next sequence from the sequence file has to be used for a successful knock. This prevents an attacker from doing a replay attack after having discovered a sequence (eg, while sniffing the network). [options] logfile = /var/log/knockd.log [opencloseSMTP] one_time_sequences = /etc/knockd/smtp_sequences seq_timeout = 15 tcpflags = fin,!ack start_command = /usr/sbin/iptables -A INPUT -s %IP% -p tcp --dport 25 -j ACCEPT cmd_timeout = 5 stop_command = /usr/sbin/iptables -D INPUT -s %IP% -p tcp --dport 25 -j ACCEPT CONFIGURATION
: GLOBAL DIRECTIVES UseSyslog Log action messages through syslog(). This will insert log entries into your /var/log/messages or equivalent. LogFile = /path/to/file Log actions directly to a file, usually /var/log/knockd.log. PidFile = /path/to/file Pidfile to use when in daemon mode, default: /var/run/knockd.pid. Interface = <interface_name> Network interface to listen on. Only its name has to be given, not the path to the device (eg, "eth0" and not "/dev/eth0"). Default: eth0. CONFIGURATION
: KNOCK/EVENT DIRECTIVES Sequence = <port1>[:<tcp|udp>][,<port2>[:<tcp|udp>] ...] Specify the sequence of ports in the special knock. If a wrong port with the same flags is received, the knock is discarded. Optionally, you can define the protocol to be used on a per-port basis (default is TCP). One_Time_Sequences = /path/to/one_time_sequences_file File containing the one time sequences to be used. Instead of using a fixed sequence, knockd will read the sequence to be used from that file. After each successful knock attempt this sequence will be disabled by writing a '#' character at the first position of the line containing the used sequence. That used sequence will then be replaced by the next valid sequence from the file. Because the first character is replaced by a '#', it is recommended that you leave a space at the beginning of each line. Otherwise the first digit in your knock sequence will be overwritten with a '#' after it has been used. Each line in the one time sequences file contains exactly one sequence and has the same format as the one for the Sequence direc- tive. Lines beginning with a '#' character will be ignored. Note: Do not edit the file while knockd is running! Seq_Timeout = <timeout> Time to wait for a sequence to complete in seconds. If the time elapses before the knock is complete, it is discarded. TCPFlags = fin|syn|rst|psh|ack|urg Only pay attention to packets that have this flag set. When using TCP flags, knockd will IGNORE tcp packets that don't match the flags. This is different than the normal behavior, where an incorrect packet would invalidate the entire knock, forcing the client to start over. Using "TCPFlags = syn" is useful if you are testing over an SSH connection, as the SSH traffic will usually inter- fere with (and thus invalidate) the knock. Separate multiple flags with commas (eg, TCPFlags = syn,ack,urg). Flags can be explicitly excluded by a "!" (eg, TCPFlags = syn,!ack). Start_Command = <command> Specify the command to be executed when a client makes the correct port-knock. All instances of %IP% will be replaced with the knocker's IP address. The Command directive is an alias for Start_Command. Cmd_Timeout = <timeout> Time to wait between Start_Command and Stop_Command in seconds. This directive is optional, only required if Stop_Command is used. Stop_Command = <command> Specify the command to be executed when Cmd_Timeout seconds have passed since Start_Command has been executed. All instances of %IP% will be replaced with the knocker's IP address. This directive is optional. SECURITY NOTES
Using the -l or --lookup commandline option to resolve DNS names for log entries may be a security risk! An attacker may find out the first port of a sequence if he can monitor the DNS traffic of the host running knockd. Also a host supposed to be stealth (eg, dropping packets to closed TCP ports instead of replying with an ACK+RST packet) may give itself away by resolving a DNS name if an attacker manages to hit the first (unknown) port of a sequence. SEE ALSO
knock is the accompanying port-knock client, though telnet or netcat could be used for simple TCP knocks instead. For more advanced knocks, see hping, sendip or packit. AUTHOR
Judd Vinet <jvinet@zeroflux.org> knockd 0.5 June 26, 2005 knockd(1)
All times are GMT -4. The time now is 07:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy