Howto: Email yourself your private and public IP on reboot - Raspberry Pi General

Cool Script I'm using: https://pastebin.com/f9QR8VER
Make account at https://futz.me first, then put it in the script, save it and put in crontab. Very useful.

Related

Extract Android SQLite Databases For Contacts, SMSs, Etc

Hi All,
I'm a Windows/Web/Database developer and I've decided to bite the bullet and learn some Java and write apps for Android. I've done Hello World and a few other programs and now I want to start playing with things like contacts and SMSs.
To make life easier I want to get copies of the various SQLite databases so that I can write my SQL queries and general play with them in my SQLite admin program on Windows.
I assume that they are just regular SQLite files like I've used in other projects so what I'd like to know if possible is:
Is my assumption about them being regular SQLite files correct?
Where do they live on the phone?
How do I get them off the phone/emulator?
Also, I don't know whether it makes a difference to what I want to do but I've not rooted my phone and don't really want to. Based on that, if it needs rooting to get them I'd be really grateful if anyone happens to have gone through this exercise before and can just attach them to a reply post.
Thanks for your time in advance
For anyone who's interested, after a load of digging I've found the following:
Contacts = /data/data/com.android.providers.contacts/databases/contacts.db
SMS = /data/data/com.android.providers.telephony/databases/mmssms.db
Bookmarks = /data/data/com.android.browser/databases/browser.db
You can get them off the emulator using the adb pull command. E.g.
adb pull /data/data/com.android.providers.contacts/databases/contacts.db d:\contacts.db
Cheers
k420 said:
For anyone who's interested, after a load of digging I've found the following:
Contacts = /data/data/com.android.providers.contacts/databases/contacts.db
SMS = /data/data/com.android.providers.telephony/databases/mmssms.db
Bookmarks = /data/data/com.android.browser/databases/browser.db
You can get them off the emulator using the adb pull command. E.g.
adb pull /data/data/com.android.providers.contacts/databases/contacts.db d:\contacts.db
Cheers
Click to expand...
Click to collapse
Adding one for Calls :
Calls -
Code:
/data/data/com.android.providers.contacts/databases/contacts2.db
Example to access :
Code:
[email protected]:/ # sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db
providers.contacts/databases/contacts2.db <
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .headers on
.headers on
sqlite>.mode column
.mode column
sqlite> select _id,number+random(),duration,name contact_name ,datetime(date/1000, 'unixepoch', 'localtime') timestamp
from calls
where number not like '1832%'
order by _id desc
limit 0 , 6 ;
_id number+random() duration contact_name timestamp
---------- -------------------- ---------- ------------ -------------------
16396 -7814232970342288419 0 2016-03-16 14:59:53
16395 -2897789212886021933 112 2016-03-16 14:27:11
16393 -5099152494103830835 262 Rajaselvam M 2016-03-16 12:28:56
16389 8412659988096325402 13 2016-03-16 09:36:48
16385 1480282204589577101 125 அம்ம 2016-03-16 08:05:07
16384 -1575337348523869115 0 Saami 2016-03-15 22:05:50
sqlite>
this is great, i dont suppose you have some code to extract sms and contacts as well do you.
i copy pasted your above code into db browser for sqlite and it worked great.
but i do not know how to write the code myself
I lost my android device but need the contacts from it...HELP!
is there any way i can extract this data from my Mac computer or do I have to do it from the android device? cause I lost the actual phone and for some reason the last month or so of contacts inputted werent backed up to my google account.
[email protected] said:
is there any way i can extract this data from my Mac computer or do I have to do it from the android device? cause I lost the actual phone and for some reason the last month or so of contacts inputted werent backed up to my google account.
Click to expand...
Click to collapse
You have to grab the actual file in order to read your contacts. The only way you'd have it on your mac is if you did a root backup of your phone.

[GPL] Shipped rom extractor (Linux)

For the first time, I today attempted to extract a rom.zip from a shipped rom release (.exe) on Linux.
The process is problematic as, after launching the executable using wine, the application crashes, deleting all its files. You therefore have to be *very* quick looking inside the ~/.wine/users/username/Temp folder for the rom.zip.
Anyway, I have knocked up a quick python script that will monitor this directory for rom.zip and copy it to your home folder.
The only modification you need to make before running is to change the username field to your own username. I would have used getpass to obtain this but, for some reason, on certain systems you need to use sudo which messes this up.
Usage:
1.) Change username in script
2.) Run script
3.) Run RUU_xxxxxx.exe
4.) Get rom.zip from home folder
Anyway, I hope this is helpful and look forward to hearing feedback.
Best,
Martin
Code:
#!/usr/bin/python
'''
ROM Extractor Copyright (c) 2010 Martin Paul Eve
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import os
import pyinotify
import io
# USERNAME IS REQUIRED (you may have to run as root using sudo)
username = "martin"
# Modify these if using a different wine location or rom name; HTC seem to use rom.zip
filename = "rom.zip"
monitor_path = "~/.wine/drive_c/users/%s/Temp/" % username
wm = pyinotify.WatchManager()
mask = pyinotify.IN_CREATE | pyinotify.IN_MODIFY | pyinotify.IN_DELETE | pyinotify.IN_MOVED_TO
bd = None
class RExtract(pyinotify.ProcessEvent):
def process_IN_MOVED_TO(self, event):
# this seems to be the event fired; IN_CREATE is included just in case, though
if event.name.endswith(filename):
print "Found ROM. Awaiting completion of modification."
self.f = open(os.path.join(event.path, event.name), "r")
self.bd = self.f.read()
def process_IN_CREATE(self, event):
if event.name.endswith(filename):
print "Found ROM. Awaiting completion of modification."
self.f = open(os.path.join(event.path, event.name), "r")
def process_IN_MODIFY(self, event):
# on modify, append to the file
if event.name.endswith(filename):
if hasattr(self, "bd"):
self.bd = self.bd + self.f.read()
else:
self.bd = self.f.read()
def process_IN_DELETE(self, event):
if event.name.endswith(filename):
self.f.close()
self.f = open(os.path.join("/home/%s/" % username, "rom.zip"), "w")
self.f.write(self.bd)
self.f.close()
print "ROM Copied to /home/%s/rom.zip" % username
raise KeyboardInterrupt
notifier = pyinotify.Notifier(wm, RExtract())
print "ROM Extractor Copyright (c) 2010 Martin Paul Eve"
print "This program comes with ABSOLUTELY NO WARRANTY."
print "This is free software, and you are welcome to redistribute it under certain conditions; see the included licence statement"
print ""
print "Monitoring: %(path)s for %(filename)s" % {"path": os.path.expanduser(monitor_path), "filename": filename}
print "Press CTRL+C to exit"
wdd = wm.add_watch(os.path.expanduser(monitor_path), mask, rec=True, auto_add=True)
while True:
try:
notifier.process_events()
if notifier.check_events():
notifier.read_events()
except KeyboardInterrupt:
notifier.stop()
break
Hey Martin there is a tool already available for this here in Forums... dint work for me for some reason.. Just informing you so that u do not reinvent the wheel ..
EDIT :: here it is: http://forum.xda-developers.com/showthread.php?t=711298
Regards
Ahh! Finally one that works!
Thanks!
TheDeadCpu said:
Ahh! Finally one that works!
Thanks!
Click to expand...
Click to collapse
Excellent; glad that my effort wasn't wasted then
I can't make it work but thanks for your job !
(and for your soft-root too !!)
voodka2007 said:
I can't make it work but thanks for your job !
(and for your soft-root too !!)
Click to expand...
Click to collapse
Could you be more specific about what happens when you run it and it doesn't work? You need python-py-inotify for it to detect the file...
Sent from my HTC Wildfire using XDA App
Script can be run, it just can't found rom.zip... i have install python-pyinotify package, and it's same.
I have try 2 monitoring path :
~/.wine/dosdevices/c:/windows/temp
and
~/.wine/drive_c/windows/temp
I have try with root, sudo, check username, chmod the script, and it's same.
voodka2007 said:
Script can be run, it just can't found rom.zip... i have install python-pyinotify package, and it's same.
I have try 2 monitoring path :
~/.wine/dosdevices/c:/windows/temp
and
~/.wine/drive_c/windows/temp
I have try with root, sudo, check username, chmod the script, and it's same.
Click to expand...
Click to collapse
Check the format of your path. It should be like this:
monitor_path = "~/.wine/drive_c/users/%s/Temp/" % username
This is because it won't extract to c:\Windows\Temp but to c:\Users\Username\Temp
Try leaving monitor path just as it was (but change the username)...
Code:
[Pyinotify ERROR] add_watch: cannot watch /home/voodka/.wine/drive_c/users/voodka/Temp/ (WD=-1)
I haven't users folder in my .wine/drive_c/
What version of windows have you set in winecfg?
Sent from my HTC Wildfire using XDA App
Thanks for your perseverance !
In my wincfg i use Windows XP
But i have try with Windows 7 and it's always same...
Do this problem can come from Wine 1.2 ? (i don't use 1.0)
Thanks...
PERFECT
i must buy you a beer
Worked for me.
Radio_13.53.55.24H_3.35.19.25_release_151892_signed.exe and Ubuntu 10.10
thanks!

V1.0: SENDEMAIL +paramter if special event ->send email via smtp -> precond: Tasker

V1.0: SENDEMAIL +paramter if special event ->send email via smtp -> precond: Tasker
i searched for a long time a tool, which can send an email (via smtp) if a specific event happen ...
But i want to customize the email messages as i like it ...(caller info, date, location data, sms text, etc ..), using of my own smtp server, etc ...
i would pay @50,- for a solution, which is working ... BUT THERE IS NO SUCH OF SOLUTION ..
after research -> there is no such kind of application, which can handle this !!!!!
so - i found a way myself ..
##################
(thanks to devels of "tasker" - i modified a script which found on tasker wiki)
SOLUTION/IDEA...
1.) IF AN EVENT HAPPEN(you can select all contect what you want ..)
then
SEND AN EMAIL (via smtp)
so it is possible to send without having a gmail account - you can use whatever you like
INSTALLATION: (preconditions)
===========
1.) install *Tasker* -> see market
2.) install *SL4A* -> see market (for details -> see http://tasker.wikidot.com/sl4a (install of sla4 + python)
3.) install Python interpretor for SL4A
4.) my script - attached -> copy the "py" file (python script) to sd-card -> /mnt/sdcard/sl4a/scripts
5.) (optional) - copy the 2 xml files to: -> /mnt/sdcard/Tasker/profiles
then start "Tasker" and there you can import my profiles
a.) profile for *missed call* -> send an email
b) profile for *new message* (SMS or MMS) -> send an email
after import - edit the profiles, and insert valid smtp user data, email adress, etc ...
options for:
# 1.) parameter: %SMTP_MAILSERVER_ADDRESS (dns or ip address)
# 2.) parameter: %SMTP_MAILSERVER_PORT (vlid port number)
# 2.) parameter: %SMTP_MAILSERVER_SECURITY (0=off, 1=ssl, 2=tls)
# 3.) parameter: %SMTP_USERNAME
# 4.) parameter: %SMTP_PASSWORD
# 5.) parameter: %MAIL_SENDER_NAME
# 5.) parameter: %MAIL_SENDER_EMAIL
# 6.) parameter: %MAIL_RECEIVER_EMAIL
# 7.) parameter: %MAIL_SUBJECT
# 8.) parameter: %MAIL_BODY
# 9.) parameter: %MAIL_ATTACHMENT (files can be added - not fully tested, because don'T use it - but should work for multiple, too)
DONE - test it
attached a profile, which you can import in "Tasker"
example: which do:
a) if new message comes in -> send email inclusive infos for date +time + sender + name + number + sms text + location + accur etc ..
b) if i miss a call -> send email inclusive infos for date +time + sender + name + number + location + accur etc ..
EDIT: v1.0
+added special characters (all converted to UTF, so "umlaute" are also working)
cu camel
is working now fine

[LIBRARY] APL - Android Proxy Library

APL (Android Proxy Library) is a library that makes it easier for app developers get the proxy settings from an Android device.
I decided to make this library when I realized that Android didn't have a standard and simple support to proxy networks that can support all the API versions (more information here). So, the first goal was to add an agnostic method to get the current proxy configuration of the device. After that, I continued adding features to the library in order to get and check proxy configuration, status and other related informations.
Anyway, here it is on GitHub: https://github.com/shouldit/android-proxy-library
The code is not so well documented, but please be patient, it's not my full time job !
I would really appreciate any feedback, comment, issue you may find, so please just write a couple of rows to me or into the GitHub Issues page.
Bye!
This looks really useful, but I am completely failing to get it imported into Eclipse successfully...
I have done:
file > import > general > existing projects into workspace
and
file > import > android > existing android code into workspace
Both with "copy files into workspace" checked and unchecked.
Every time, I get 1021 errors in the console with things like:
Code:
android.net.LinkProperties cannot be resolved to a type
What am I doing wrong? Is there some extra setup step that I missed?
redders6600 said:
This looks really useful, but I am completely failing to get it imported into Eclipse successfully...
I have done:
file > import > general > existing projects into workspace
and
file > import > android > existing android code into workspace
Both with "copy files into workspace" checked and unchecked.
Every time, I get 1021 errors in the console with things like:
Code:
android.net.LinkProperties cannot be resolved to a type
What am I doing wrong? Is there some extra setup step that I missed?
Click to expand...
Click to collapse
You should exclude from the build of the library all the source files that are contained into the "excluded_from_build" folder. Those files are there only to have a fast reference for reflecting the Android source files.
Anyway I've on my todo list the task to provide an easily library package (aar). It should be ready soon.

Kotlin app can't find file even though it exists

I'm working on a Kotlin app where I need to access the Cookies file located at /data/data/com.android.chrome/app_chrome/Default/Cookies. However, when I try to access the file, I get a "file not found" error, even though the file definitely exists at that location.
I've double-checked the file path and made sure there are no typos (I can see the file with adb shell and Amaze File Manager), and I've also checked that the app has permission to access the file (app has root permissions).
First I was trying to open and read the file directly and I got the error:
CODE at https://stackoverflow.com/questions/76064385/kotlin-app-cant-find-file-even-though-it-exists
I though maybe Chrome was running so I couldn't open the file directly so I tried copying it to a temp folder and reading that:
CODE at https://stackoverflow.com/questions/76064385/kotlin-app-cant-find-file-even-though-it-exists
But that still fails:
CODE at https://stackoverflow.com/questions/76064385/kotlin-app-cant-find-file-even-though-it-exists
Is there anything else I can try to troubleshoot this issue?
Something in the code triggers cloudflare and blocks me from posting
Code:
Sorry, you have been blocked
You are unable to access xda-developers.com
Why have I been blocked?
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
What can I do to resolve this?
You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.
Cloudflare Ray ID: 7badda7c6b9486c6 • Your IP: Click to reveal • Performance & security by Cloudflare
SQLite definitely won't open the file. So, your decision to copy it was right.
Firstly, try to split the single command string into an array.
The documentation for ProcessBuilder class has an example:
ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1", "myArg2");
Or try to use SuFile from the libsu, for example:
AndroidIDeditor/Util.java at 6a62bac0e3e63502e9a7b538217f65189ff85fa4 · sdex/AndroidIDeditor
Android Device ID changer. Contribute to sdex/AndroidIDeditor development by creating an account on GitHub.
github.com
lioce said:
SQLite definitely won't open the file. So, your decision to copy it was right.
Firstly, try to split the single command string into an array.
The documentation for ProcessBuilder class has an example:
ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1", "myArg2");
Or try to use SuFile from the libsu, for example:
AndroidIDeditor/Util.java at 6a62bac0e3e63502e9a7b538217f65189ff85fa4 · sdex/AndroidIDeditor
Android Device ID changer. Contribute to sdex/AndroidIDeditor development by creating an account on GitHub.
github.com
Click to expand...
Click to collapse
Seems like not even like that can I read the Cookies file from Chrome
Code:
fun copyFile(source: String, destination: String) {
Log.d("CookieSwapLogger", "copyFile '$source' to '$destination'")
val sourceFile = SuFile(source)
if (sourceFile.exists()) {
Log.d("CookieSwapLogger", "sourceFile.exists")
} else {
Log.d("CookieSwapLogger", "sourceFile.notExists")
}
---------------
2023-04-21 18:20:47.440 6347-6347 CookieSwapLogger com.david.cookieswapper D copyFile '/data/data/com.android.chrome/app_chrome/Default/Cookies' to '/data/user/0/com.david.cookieswapper/app_temp/Cookies'
2023-04-21 18:20:47.492 6347-6347 CookieSwapLogger com.david.cookieswapper D sourceFile.notExists

Categories

Resources