Skip to content

Instantly share code, notes, and snippets.

@mike-zhang
Created June 27, 2016 03:11
Show Gist options
  • Save mike-zhang/220c8c1cc144763379c6e193e7379cb4 to your computer and use it in GitHub Desktop.
Save mike-zhang/220c8c1cc144763379c6e193e7379cb4 to your computer and use it in GitHub Desktop.
compare linux so files funcs
#! /usr/bin/env python
# -*-coding:utf-8 -*-
"""
compare so files funcs
test pass : centos6.4_x64
e-mail : mike_zhang@live.com
"""
import os
def getFuncNames(iterObj,refList):
for line in iterObj:
arr = line.strip().split(" ")
refList.append(arr[-1])
def getData(cmd,refList):
rows = os.popen(cmd).read().split("\n")
getFuncNames(rows,refList)
mysqlList = []
odbcList = []
getData("nm /usr/local/mysql/lib/libmysqlclient.so.18",mysqlList)
getData("nm /usr/lib/libodbc.so.2",odbcList)
#set([12,3]) & set([1,3])
result = list(set(mysqlList) & set(odbcList))
for item in result :
print item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment