[Q] App for PING with timestamp - General Questions and Answers

Hi,
I am looking for an application for Android which will allow me to ping a server (or webpage) of my choice, will allow me to log the results and the results will be with a timestamp. I have tried several apps for pinging but none of them seems to do the trick. If any of you have a tip for a tool that will meet all the requirements listed above your help will be very appreciated! Thanks in advance!
J.

Any Idea? Thanks.

Have you tried the ping command in a terminal emulator? That might help

samsungrockz said:
Have you tried the ping command in a terminal emulator? That might help
Click to expand...
Click to collapse
I did but I didn't get any positive results. There is an option to add a timestamp but it is not working for me. What I tried to do in there:
ping -T tsonly 8.8.8.8
But after trying this command I don't get abny printout. Also I don't know if there is an option to do a logfile.

I m confused too, when i try pinging localhost, i get a printout data displayed but when i ping some other site like google.com, no printout appears just like you!!!
And then you asked how to save logfile of a command, its pretty easy, just redirect the output thus-->
Code:
command >output_file.txt
try it

samsungrockz said:
I m confused too, when i try pinging localhost, i get a printout data displayed but when i ping some other site like google.com, no printout appears just like you!!!
And then you asked how to save logfile of a command, its pretty easy, just redirect the output thus-->
Code:
command >output_file.txt
try it
Click to expand...
Click to collapse
Thanks for that - it is logging flawlessly but I am still not able to insert timestamp.
Without:
Code:
ping 8.8.8.8 >storage/sdcard0/ping/out.txt
works fine and logs.
With:
Code:
ping -T tsonly 8.8.8.8 >storage/sdcard0/ping/out.txt
does absolutely nothing.
Any Ideas

jendus said:
Thanks for that - it is logging flawlessly but I am still not able to insert timestamp.
Without:
Code:
ping 8.8.8.8 >storage/sdcard0/ping/out.txt
works fine and logs.
With:
Code:
ping -T tsonly 8.8.8.8 >storage/sdcard0/ping/out.txt
does absolutely nothing.
Any Ideas
Click to expand...
Click to collapse
When i try
Code:
ping -tsonly 8.8.8.8
something shows up, see it, i don't think its a timestamp though

Once I try that i just get "Can't set unicast time-to-live: Invalid argument"

So the most suitable (working) solution for my needs seems to be running PING with -D parameter. It is doing everything I expected and in the end you just have to recalculate UNIX time to whatever you need.
Code:
ping -D 8.8.8.8 >storage/sdcard0/ping/out.txt

Related

"Permission Denied" trying to ssh from terminal

Hey folks, having an issue trying to ssh from within the terminal app using CM5 or CM6. Not a huge issue, ConnectBot works just fine. But I was hoping to use the command line ssh program to script up a few things.
The first is that ssh doesn't appear to use DNS. No matter what domain name I give it, it errors out. So I've just been feeding it IP addresses directly instead.
Second: I can use ssh as root no problem, but not as a normal user. When running as root it complains about trying to create /.ssh on a readonly filesystem, but it completes the connection and functions. However, when trying to run as a normal user ssh just says "permission denied" and exits. I had assumed it was trying to create a .ssh and failing. I've tried setting up a directory that the user can write to under /data and setting that as HOME before running ssh, but I still get the same error.
Anyone know what the real underlying error might be here, and how to fix it? Thanks.

Automatic wireless folder sync app needed

Hi,
I have looked around and cant seem to find an application quite fitting.
All I want is an app that will wirelessly sync just a folder automatically when I have my WiFi turned on, is there an app that can do this?
i.e. Come home from work, turn on wifi and it just syncs.
Many thanks
To any developers about: How hard would something like this be to make?
I think dropbox does that?
Dropbox syncs a folder on multiple devices with a folder on dropbox server.
There is also an app called PCFileSync that syncs a folder over wifi between the phone and a samba share. I am turning it on with Tasker once it connects to my home ssid. Works great!
Sent from my Desire HD using XDA App
samba share? hm........
rsync and ssh would be a much better choice and cleaner, just a script to run.
synflex said:
samba share? hm........
rsync and ssh would be a much better choice and cleaner, just a script to run.
Click to expand...
Click to collapse
http://a-more-common-hades.blogspot.com/2010/07/backup-photos-with-rsync.html
Tasker+Rsync, and combine it with a ssh key and you can automate it easy.
BTW, I decided to do this today.. I have one which backs up /sdcard/DCIM, and another which backs up the entire sdcard, both over wifi to my Fedora Linux workstation. I'll have to figure out how I want to execute these, but I can do it from GScript Lite, Tasker, whatever floats my boat.
Here's the notes I took, just in case I have to do it again in the future, hope it's useful to some folks..
# Get dropbear/dropbearkey from http://www.elkins.org/dropbear.tar.gz
# Get ssh off device and follow instructions (references at the end) to fix it, name fixed file "sshfxed"
# Remount /system rw
~/AndroidSDK/tools/adb shell
su
mount -o rw,remount device /system
#exit back to Linux shell
Click to expand...
Click to collapse
# Install dropbear and sshfixed from adb push
~/AndroidSDK/tools/adb push sshfixed /system/xbin/sshfixed
~/AndroidSDK/tools/adb push dropbear /system/xbin/dropbear
~/AndroidSDK/tools/adb push dropbearkey /system/xbin/dropbearkey
Click to expand...
Click to collapse
# Now get into adb shell and execute in Android..
mkdir /system/etc/dropbear
chmod 4755 /system/bin/dropbear
chmod 4755 /system/bin/dropbearkey
Click to expand...
Click to collapse
# Create keys
dropbearkey -t rsa -f /system/etc/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /system/etc/dropbear/dropbear_dss_host_key
Click to expand...
Click to collapse
# Copy and paste the public DSS key the dss command above outputs and put it in ~/.ssh/authorized_keys on intended host. If you need to know more here, google for how to use ssh keys on Linux hosts. Basically if you're going to [email protected], on machine1 under user account "user" you create a file named authorized_keys in the .ssh directory with the output of the previous command, it tells you it's the 'public key', which is what you want to copy. It has to be all one line.
# Now actually use it all and rsync sdcard to your host For debugging, I suggest trying the "sshfixed -l USER -y -i /system/etc/dropbear/dropbear_dss_host_key" part just by itself and make sure you can ssh to your machine WITHOUT any prompting, password, etc.
~/AndroidSDK/tools/adb shell
# the following is all one line..
rsync -rltDv --chmod=u=rwX,g=rX,o=rX -e "sshfixed -l USER -y -i /system/etc/dropbear/dropbear_dss_host_key" /mnt/sdcard [email protected]:/your/path
Click to expand...
Click to collapse
-- References
Get dropbear - http://forum.xda-developers.com/showthread.php?p=8220181
Set up dropbear - http://forum.xda-developers.com/showthread.php?t=442754
Fix ssh client to use urandom - https://www.heiher.info/1592.html
Use it all to rsync over wifi - http://a-more-common-hades.blogspot.com/2010/07/backup-photos-with-rsync.html
Another vote for Dropbox, it works great! Look for referral codes in the comments on Market for some additional free storage. I use it all the time for pictures and vids for the family.
Sent from my HTC Desire using the XDA App
I use S&K sync.
Horrible user interface but once things are set up you need only to start the client on your phone and press the "Start Sync" button.
Supports multiple configuration sets (local/remote directory pairs, ip address, etc), each can be started separately.
Google: "SK sync android"
khaytsus said:
http://a-more-common-hades.blogspot.com/2010/07/backup-photos-with-rsync.html
Tasker+Rsync, and combine it with a ssh key and you can automate it easy.
Click to expand...
Click to collapse
I'm actually syncing to 2 android phones, with dropbox, rsync and dropbear.
Dropbox is good for documents and such, with small filesize and possiblity of sharing with others.
Using rsync for large files like movies and music folders, also some pictures, notes, keepass, and stuffs I like having around, things that's only going around between my laptop and phone.
Running a crontab that scans for my phone in adb devices, if found, pull a "last sync status" file, if interval > 1 hour or changes made locally, do a local notify-send till rsync is done, then execute dropbear on phone, rsync remote and local, kills dropbear, then push last sync file.
This way, no resources is wasted on the phone, all scanning and verification of device, system, and files were done on laptop.
At the same time I'm monitoring my development phone with frequent ssh rsync when it's in range, push updates, kernels and such across in proper folder structure.
This will ensure changes or new kernels were pushed to phone ready for testing.
Could use the same script for both phone, be it adb+ssh+rsync or pure ssh+rsync, but I personally don't like having sshd running in background when I'm connected to wifi hotspot.
Cleaner this way, less resources wasted on phone, and I can have full control over what, where, and when to sync.
I do realise that there isn't much choice for syncronization in the wild, thus you may like yo try something along the same idea, and you may get your own perfect combo to sync.
P.S. backing up, restoring or syncing bookmarks from browser.db and such could be done this way.

[INFO] OpenVPN

I just got OpenVPN working and thought I would share:
Rooted
Installed tun.ko
http://forum.xda-developers.com/showthread.php?t=1063656
Note: Skip this step if you are running Prime or any other ROM with the tun.ko module pre-installed.
Installed BusyBox using BusyBox Installer (Market). Installed to /system/xbin
Installed OpenVPN using OpenVPN Installer (Market) to /system/xbin
Installed OpenVPN Settings (Market)
Replaced OpenVPN binary with the one from:
http://code.google.com/p/android-openvpn-settings/issues/detail?id=26
UnBZ2'ed the file (I used 7-Zip on Windows for this)
adb remount
adb push openvpn-static-2.1.1 /system/xbin/openvpn
adb shell
chmod 555 /system/xbin/openvpn
Created /system/xbin/bb directory (requested in research I did, not sure if required)
mkdir /system/xbin/bb
Symlinked Busybox ifconfig and route /system/xbin/bb
ln -s /system/xbin/ifconfig /system/xbin/bb/ifconfig
ln -s /system/xbin/route /system/xbin/bb/route
Set up my usual OVPN config (configs must have absolute paths to certs!)
OpenVPN settings > Advanced > Load tun kernel module ON
OpenVPN settings > Advanced > TUN module settings
Load module using > insmod
Path to tun module > /system/lib/modules/tun.ko
I think this is everything I did, there was a bit of trial and error so I may have forgotten something.
Checked and the thing still boots afterward
Thanks a lot , will report back when i try it.
I get
insmod: init_module '/system/lib/modules/tun.ko' failed (Exec format error)
Assuming you have installed BusyBox, check the md5sum of your tun.ko:
# cd /system/lib/modules
# md5sum tun.ko
Response should be (or at least this is what I get):
7e09817dc4661b732f1a77fff76a10e6 tun.ko
If you don't get that response, I suggest you re-download the tun module, decompress it again and re-push it to your Transformer.
Busybox is installed. Tried both installers and both versions.
Md5sum is right.
Any other ideas?
Are you running stock? If you are running a different kernel the module probably won't work.
Thanks worked a treat
thanks works perfect
I am getting my Transformer within a week. Can't wait to get this going on the device... Thanks a ton!
It's running and connected but my IP is still showing up as my regular ISP 3G IP when I open a browser and go to www.ipchicken.com
Any idea why the traffic doesn't appear to be routing through it?
It shows as 100% connected and the key icon is white in the taskbar...
duckdown said:
Any idea why the traffic doesn't appear to be routing through it?
Click to expand...
Click to collapse
The default behaviour of OpenVPN is not to install a default route pointing out of the tun interface, unless the system you're connected to has IP forwarding and NAT enabled this wouldn't work anyway.
I can't post links, so google "openvpn config" and go to the first link. Look for the section titled: "Routing all client traffic (including web-traffic) through the VPN."
Hey man, thanks for the reply.
The directions said to add this line to the config file
Code:
push "redirect-gateway def1"
But I've done that and it still doesn't seem to be doing anything.. IP is still showing up as my regular 3G network
Am I doing something wrong or omitting a step that you can notice?
Thanks again for the help
Oh, hm, on second look it wants me to add that line to the SERVER's config file.
I have no access to the servers config file -- I pay $4 a month for my VPN and do not run the OpenVPN server myself.
Is there anything I can do from the client side?
It works perfectly fine in Windows, routing all traffic through the VPN as it should..
duckdown said:
Oh, hm, on second look it wants me to add that line to the SERVER's config file.
I have no access to the servers config file -- I pay $4 a month for my VPN and do not run the OpenVPN server myself.
Is there anything I can do from the client side?
It works perfectly fine in Windows, routing all traffic through the VPN as it should..
Click to expand...
Click to collapse
You might actually be able to just use the "redirect-gateway local def1" line in your own config, as I understand it the "push" directives in the server conf are just sending config to the clients which could just as easily be done client side. I might be wrong, but it's worth a go. Otherwise you can set up routes in the client config too, but you may have to remove your existing default route via some scripting or something.
duclicsic said:
You might actually be able to just use the "redirect-gateway local def1" line in your own config, as I understand it the "push" directives in the server conf are just sending config to the clients which could just as easily be done client side. I might be wrong, but it's worth a go. Otherwise you can set up routes in the client config too, but you may have to remove your existing default route via some scripting or something.
Click to expand...
Click to collapse
This is correct, I have this and the exact same conf works fine on my desktop.
However on my tablet no data gets routed. Also my tray is getting spammed with "Connected".
Kevincod said:
This i correct, I have this and the exact same conf works fine on my desktop.
However on my tablet no data gets routed. Also my tray is getting spammed with "Connected".
Click to expand...
Click to collapse
+1
10chars...
I forgot the part with the modified openvpn, I replaced the binary and the routing works great now, however I still get spammed with "Connected" in the tray.
Seems to be a common issue: http://code.google.com/p/android-openvpn-settings/issues/detail?id=74#c0
I can't get the traffic to go through the VPN for the life of me.. This thing is mental
Check out thread 1118465, in The general section. Found that /system/bin/ip was not setting up route/gateway correctly, and openvpn was not using the busybox ip
fix: mv /system/bin/ip /system/bin/ip.bay
This then forces use of busybox ip. Worked for me.
PowellEB said:
Check out thread 1118465, in The general section. Found that /system/bin/ip was not setting up route/gateway correctly, and openvpn was not using the busybox ip
fix: mv /system/bin/ip /system/bin/ip.bay
This then forces use of busybox ip. Worked for me.
Click to expand...
Click to collapse
We had to do the same thing to get Cisco VPN working. the system IP was not routing properly, so renaming it forced using the busybox IP

[Q] Log

Good morning.
Usually work with a VPN to connect to my company. A few weeks ago I installed a Mac and access to fix some problems I was of use the tail command to view the log.
Now I'm trying to install the Tablet access and would like to review the event log. In the terminal emulator I can use the tail command but do not know where to find the system.log file or similar.
Can you help?
regards
Try command "logcat", should give you streaming log...

[Tutorial] How to Ping a website from Android phone

I do a lot of things with network maintenance, diagnostics, and security on my PC. I found pinging a site to test my latency from my SG3 was useful, testing when/where I get the best latency on my mobile data network.
So without further a due, here is a short, simple but thorough tut
1.) Download "Android Terminal Emulator" by from the Play Store, there are apps dedicated for pinging specifically; however I like to use the terminal/cmd prompt whenever I can. Manual work seems to give me the results I am looking for and nothing extra! (Most of you probably already have the Terminal Emulator downloaded.)
Link to app on play.google.com:
https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en
2) Open the terminal.
Type in the command: ping example.com
Note: example.com is a placeholder, insert any website you want to ping here.
If you do not want to ping the site infinitely, then...
Type the following command: ping -c4 example.com
-c being a counter and 4 being the number of times you want to send a ping packet to the server. Four is the default for the ping function from the Windows Command Prompt so if you are used to that, then use four.
Screenshot of terminal/ping -c command after execution.
Sent from my SAMSUNG-SGH-I747 using xda app-developers app

Categories

Resources