如何把控制台输出的信息转存到mysql里?控制台输出我已经重定向到管道,接下来该怎么转存到数据库啊?
2个回答
推荐于2016-01-29
展开全部
'执行并返回一个命令行程序(shell程序)的标准输出和标准错误输出
'通常命令行程序的所有输出都衡核枣直接送到屏幕上
Private Function ExecuteApp(sCmdline As String) As String
Dim proc As PROCESS_INFORMATION, ret As Long
Dim start As STARTUPINFO
Dim sa As SECURITY_ATTRIBUTES
Dim hReadPipe As Long '负咐拆责氏薯读取的管道
Dim hWritePipe As Long '负责Shell程序的标准输出和标准错误输出的管道
Dim sOutput As String '放返回的数据
Dim lngBytesRead As Long, sBuffer As String * 256
'通常命令行程序的所有输出都衡核枣直接送到屏幕上
Private Function ExecuteApp(sCmdline As String) As String
Dim proc As PROCESS_INFORMATION, ret As Long
Dim start As STARTUPINFO
Dim sa As SECURITY_ATTRIBUTES
Dim hReadPipe As Long '负咐拆责氏薯读取的管道
Dim hWritePipe As Long '负责Shell程序的标准输出和标准错误输出的管道
Dim sOutput As String '放返回的数据
Dim lngBytesRead As Long, sBuffer As String * 256
追问
用C实现抓取执行Linux shell命令的控制台输出,转存到MySQL数据库。现在以经把截获的控制台信息通过管道读到一个buff中。数据格式为每条64字节长,包含源ip,源端口,目的ip,目的端口,目的mac等信息。怎么把这条数据信息按字段存到MySQL数据库中呢?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询