09 用户态跟踪:如何使用eBPF排查应用程序?

09 用户态跟踪:如何使用eBPF排查应用程序?

sudo bpftrace -e 'usdt:/usr/bin/python3:function__entry { printf("%s:%d %s\n", str(arg0), arg2, str(arg1))}'

-*- coding: UTF-8 -*-

import socket

from socket import SOL_SOCKET, SO_REUSEADDR

import subprocess

import struct

import json

PORT = 18284

#简单TCP通信

def main():

tcpSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

print(tcpSocket)

tcpSocket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)

tcpSocket.bind(('127.0.0.1', PORT))

tcpSocket.listen(5)

print('start....')

while True:

conn, client_addr = tcpSocket.accept()

print('new client connected ', conn, client_addr)

while True:

try:

print('recv data ...')

data = conn.recv(1024)

if len(data) == 0:

break

print('recv data is ', data)

conn.send(data.upper())

except ConnectionResetError:

break

conn.close()

phone.close()

main()

/usr/lib/python3.9/socket.py:220 init

/usr/lib/python3.9/socket.py:243 repr

/usr/lib/python3.9/socket.py:513 family

/usr/lib/python3.9/socket.py:99 _intenum_converter

/usr/lib/python3.9/enum.py:358 call

/usr/lib/python3.9/enum.py:670 new

/usr/lib/python3.9/socket.py:519 type

/usr/lib/python3.9/socket.py:99 _intenum_converter

/usr/lib/python3.9/enum.py:358 call

/usr/lib/python3.9/enum.py:670 new

/usr/lib/python3.9/enum.py:740 str

/usr/lib/python3.9/enum.py:740 str

/usr/lib/python3.9/socket.py:286 accept

/usr/lib/python3.9/socket.py:513 family

/usr/lib/python3.9/socket.py:99 _intenum_converter

/usr/lib/python3.9/enum.py:358 call

/usr/lib/python3.9/enum.py:670 new

/usr/lib/python3.9/socket.py:519 type

/usr/lib/python3.9/socket.py:99 _intenum_converter

/usr/lib/python3.9/enum.py:358 call

/usr/lib/python3.9/enum.py:670 new

/usr/lib/python3.9/socket.py:220 init

/usr/lib/python3.9/socket.py:243 repr

/usr/lib/python3.9/socket.py:513 family

/usr/lib/python3.9/socket.py:99 _intenum_converter

/usr/lib/python3.9/enum.py:358 call

/usr/lib/python3.9/enum.py:670 new

/usr/lib/python3.9/socket.py:519 type

/usr/lib/python3.9/socket.py:99 _intenum_converter

/usr/lib/python3.9/enum.py:358 call

/usr/lib/python3.9/enum.py:670 new

/usr/lib/python3.9/enum.py:740 str

/usr/lib/python3.9/enum.py:740 str

相关推荐
Ws_3 小时前
leetcode LCR 068 搜索插入位置
数据结构·python·算法·leetcode
谈谈叭3 小时前
Javascript中的深浅拷贝以及实现方法
开发语言·javascript·ecmascript
lx学习3 小时前
Python学习26天
开发语言·python·学习
qq_273900234 小时前
pytorch register_buffer介绍
人工智能·pytorch·python
大今野4 小时前
python习题练习
开发语言·python
爱编程的鱼4 小时前
javascript用来干嘛的?赋予网站灵魂的语言
开发语言·javascript·ecmascript
q567315235 小时前
用 PHP或Python加密字符串,用iOS解密
java·python·ios·缓存·php·命令模式
捕鲸叉5 小时前
C++设计模式和编程框架两种设计元素的比较与相互关系
开发语言·c++·设计模式
未知陨落6 小时前
数据结构——二叉搜索树
开发语言·数据结构·c++·二叉搜索树
大波V56 小时前
设计模式-参考的雷丰阳老师直播课
java·开发语言·设计模式