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

相关推荐
这里有鱼汤17 分钟前
miniQMT下载历史行情数据太慢怎么办?一招提速10倍!
前端·python
databook9 小时前
Manim实现脉冲闪烁特效
后端·python·动效
程序设计实验室10 小时前
2025年了,在 Django 之外,Python Web 框架还能怎么选?
python
倔强青铜三11 小时前
苦练Python第46天:文件写入与上下文管理器
人工智能·python·面试
用户25191624271115 小时前
Python之语言特点
python
刘立军15 小时前
使用pyHugeGraph查询HugeGraph图数据
python·graphql
数据智能老司机18 小时前
精通 Python 设计模式——创建型设计模式
python·设计模式·架构
数据智能老司机20 小时前
精通 Python 设计模式——SOLID 原则
python·设计模式·架构
c8i21 小时前
django中的FBV 和 CBV
python·django
c8i21 小时前
python中的闭包和装饰器
python