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

相关推荐
带娃的IT创业者27 分钟前
《Python实战进阶》No39:模型部署——TensorFlow Serving 与 ONNX
pytorch·python·tensorflow·持续部署
Bruce-li__34 分钟前
深入理解Python asyncio:从入门到实战,掌握异步编程精髓
网络·数据库·python
九月镇灵将44 分钟前
6.git项目实现变更拉取与上传
git·python·scrapy·scrapyd·gitpython·gerapy
车载小杜1 小时前
基于指针的线程池
开发语言·c++
沐知全栈开发1 小时前
Servlet 点击计数器
开发语言
m0Java门徒1 小时前
Java 递归全解析:从原理到优化的实战指南
java·开发语言
小张学Python1 小时前
AI数字人Heygem:口播与唇形同步的福音,无需docker,无需配置环境,一键整合包来了
python·数字人·heygem
跳跳糖炒酸奶1 小时前
第四章、Isaacsim在GUI中构建机器人(2):组装一个简单的机器人
人工智能·python·算法·ubuntu·机器人
桃子酱紫君2 小时前
华为配置篇-BGP实验
开发语言·华为·php
步木木2 小时前
Anaconda和Pycharm的区别,以及如何选择两者
ide·python·pycharm