Linux2019. 7. 3. 15:15

libxml2를 깔다보니 xmllint가 끌려왔는데

내가 원하는 속성을 한번더 출력하지 않으면 더 행복할거 같은데...

 

xmllint --xpath '//element/@attribute' file.xml
xmlstarlet sel -t -v "//element/@attribute" file.xml
xpath -q -e '//element/@attribute' file.xml
xidel -se '//element/@attribute' file.xml
saxon-lint --xpath '//element/@attribute' file.xml

[링크 : https://stackoverflow.com/questions/15461737/how-to-execute-xpath-one-liners-from-shell]

'Linux' 카테고리의 다른 글

musl / uclibc  (0) 2019.07.15
hostnamectl  (0) 2019.07.10
브릿지를 이용하여 복수개의 네트워크 카드를 허브로 사용하기  (0) 2019.07.03
wget -m (mirror)  (0) 2019.06.26
bash argument list is too long  (0) 2019.06.25
Posted by 구차니
Linux API/network2019. 7. 3. 13:30

음.. 두개는 연관이 없는 건가? 헷갈림

 

raw socket

sd = socket(PF_INET, SOCK_RAW, IPPROTO_UDP);

[링크 : https://www.tenouk.com/Module43a.html]

[링크 : http://naver.pages.kr/140042345641]

 

#define IPPROTO_TCP 6

#define IPPROTO_UDP 17

[링크 : https://unix.superglobalmegacorp.com/BSD4.4/newsrc/netinet/in.h.html]

 

promiscous mode

s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))

[링크 : https://sangchul.kr/530]

[링크 : https://stackoverflow.com/questions/114804/reading-from-a-promiscuous-network-device]

 

#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */

[링크 : https://github.com/spotify/linux/blob/master/include/linux/if_ether.h]

 

 

PF_*, AF_* 차이(없다)

[링크 : http://blog.naver.com/PostView.nhn?blogId=l18400&logNo=60109296392]

 

AF_INET is used, if you want to communicate using Internet protocols: TCP or UDP.

AF_PACKET is used if you want to play with packets at the protocol level, i.e. you are implementing your own protocol. Only processes with effective UID 0 [root] or the capability CAP_NET_RAW may open packet sockets.

[링크 : https://www.quora.com/Whats-the-difference-between-the-AF_PACKET-and-AF_INET-in-python-socket]

'Linux API > network' 카테고리의 다른 글

TCP timeout  (0) 2020.09.29
UDS (Unix Domain Socket)  (0) 2020.09.01
리눅스 UDP 소켓  (0) 2019.05.24
리눅스 TCP 소켓  (0) 2019.05.24
linux udp cpp example  (0) 2019.05.16
Posted by 구차니
Linux2019. 7. 3. 09:58

말이 기네

간단하게 br0 인터페이스로 여러개의 NIC을 단순 허브로 사용하겠다~ 라는것

 

근데 막상해보니 자기 자신(eth0)의 ip가 먹통이 되듯 외부로 안나가고 외부로 부터 ping도 안되지만

eth1 쪽으로 다른 pc를 물렸을때 다른 pc는 정상적으로 인터넷이 된다.. (이게 머야)

sudo brctl addbr br0
sudo brctl addif eth0
sudo brctl addif eth1
sudo brctl stp br0 off
sudo brctl setageing br0 0
sudo brctl setfd br0 0
sudo ifconfig br0 up

[링크 : https://sugerent.tistory.com/368]

[링크 : https://techglimpse.com/convert-linux-bridge-hub-vm-interospection/]

'Linux' 카테고리의 다른 글

hostnamectl  (0) 2019.07.10
command line xml parse  (0) 2019.07.03
wget -m (mirror)  (0) 2019.06.26
bash argument list is too long  (0) 2019.06.25
sgrep  (0) 2019.06.24
Posted by 구차니