lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> On 23 Jul 2018, at 10:48, Leema Singh <> wrote:
> what is this code not generating pcap file in pc with ip address when run from remote computer
> function tcpdump_file(pwd,user,ip,filename,cmd)
> os.execute ('sshpass -p '..pwd..' ssh -o StrictHostKeyChecking=no '..user..'@'..ip..'<<exit')
> if cmd=='start' then
> os.execute('tcpdump -i 2 -w '..filename..' &')
> --os.execute('exit')
> elseif cmd=='stop' then
> os.execute("kill -9 `ps -ef | grep "..filename.." | grep -v grep | awk '{print $2}'`")
> end
> os.execute('exit')
> end
> tcpdump_file("lee34","root","","test123.pcap",'start')

From this an previous posts, it seems that a shell script might be the better solution for your case.

Now if that is not an option, then I suppose you are trying to troubleshoot some application or device that has Lua embedded. In that case it might be good to know that Lua is generally used as an “extension language” to provide scripting capabilities to applications or devices. And in those circumstances the things you try to do are mostly provided, as well as limited by the host application/device.

You might be best of trying to find the information you’re looking for in the community of your device/application, since this mailing list is mostly about generic Lua and most people here probably have no experience with your device/application.