Raspberry GPIO email script - Raspberry Pi Development

Hi,
I made a simple script that sends me an email when the raspberry detects a rising signal on a gpio input
Between the switch and the gpio i have mounted a resistor (1K ohm all connections are soldered) to prevent the gpio from flaoting
Script works well but when it is up and running for about 15min the RPI detects a rising signal?
Can someone help me out?
greets kawa
Script:
--------------------------------------------------------------------------
import smtplib
import time
def sendemail(from_addr, to_addr_list, cc_addr_list,
subject, message,
login, password,
smtpserver='smtp.gmail.com:587'):
header = 'From: %s\n' % from_addr
header += 'To: %s\n' % ','.join(to_addr_list)
header += 'Cc: %s\n' % ','.join(cc_addr_list)
header += 'Subject: %s\n\n' % subject
message = header + message
server = smtplib.SMTP(smtpserver)
server.starttls()
server.login(login,password)
problems = server.sendmail(from_addr, to_addr_list, message)
server.quit()
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(24, GPIO.OUT, initial=False) #Siren pin setup
try:
GPIO.wait_for_edge(23, GPIO.RISING)
print "\nRising edge ALARM"
sendemail(from_addr = '@gmail.com',
to_addr_list = ['@gmail.coml'],
cc_addr_list = [''],
subject = 'ALARM',
message = 'alarm',
login = '@gmail.com',
password = '****')
GPIutput(24, True)
time.sleep(5)
except KeyboardInterrupt:
GPIO.cleanup() # clean up GPIO on CTRL+C exit
GPIO.cleanup() # clean up GPIO on normal exit

Related

[WM6.5] [Programs] JML.... tools (02-Nov-2010)

Programs Used in JMLToday <= 5.92​
Post#2 : Programs Informations
JMLPicture.exe See Post#3
Build a picture from multiple images/texts
JMLMenu.exe
Displays a context popup menu.
JMLComm.exe
Phone on/flight-mode, Wifi on/off, BT on/off/discoverable, Data on/off
JMLCalendar.exe
Saves the next appointments in registry
JMLSms.exe
Saves SMS in registry
JMLContacts.exe
Saves the next birthdays/anniversaries AND Favorites contacts in registry
JMLMeteo.exe
Saves the MSN or ACCU or GOOGLE weather informations in registry
JMLTasks.exe
Saves the next tasks in registry
Programs Informations ​
JMLMenu v1.80
The menu is configurable via a .mnu file :
- The main menu is [Menu]
- One element per line of menu : label= program;parameters
- One section per submenu : use [] -> label=[mysubmenu]
- External submenu (.mnu file) : use {} -> label={filesubmenu.mnu}
- Separator : sepX=SEPARATOR (X=unique number)
Parameters :
Code:
[b][color=red]-execute[/color][/b] if menu as once choice, it execute it immediately (menu not show)
[b]-x:[/b]X = X coordinate (X clic per default)
[b]-y:[/b]Y = Y coordinate (Y clic per default)
[b]-timeout:[/b]N = timeout in seconds to hide menu (10s per default)
Example : JMLAction.mnu
Code:
[Menu]
Restart Titanium=%JMLTODAY%\JMLToday.exe;-refresh
Update=%JMLTODAY%\JMLToday.exe;-update
Weather=%JMLTODAY%\JMLMeteo.exe;-jmltoday
Configuration=[color=blue][b][Config][/b][/color]
Parameters=[color=blue][b]{JMLParameters.mnu}[/b][/color]
[color=blue][b][Config][/b][/color]
Clock=%WINDOWS%\ctlpnl.exe;cplmain.cpl,16,0
Skin=%JMLTODAY%\JMLTodaySkins.mscr
City=%JMLTODAY%\JMLTodayVille.mscr
Language=%JMLTODAY%\JMLLang.mscr
To Launch :
- in a .pnx file : %JMLTODAY%\JMLMenu.exe;JMLAction.mnu
- in a .mscr script : Run(instPath&"\JMLMenu.exe","JMLAction.mnu")
---------------------------------------------------------------------------------
JMLComm v1.98
Parameters :
Code:
[color=red]-vibrate:duration[/color] = make a vibration (duration=25ms per default)
[color=red]-volume[/color] = toggle vibrate/mute/normal mode[color=red]
-volume:mode[/color] = volume mode : [b]vibrate,mute, normal[/b]
[color=red]-volume:level[/color] = volume level : [b]silent,verylow,low,medium,high,loud[/b]
[color=red]-backlight[/color] = toggle auto/manual mode
[color=red]-backlight:mode[/color] = backlight mode : [b]auto,manual[/b]
[color=red]-backlight:level[/color] = backlight level : [b]mini,low,medium,high,maxi[/b]
[color=red]-gps:timeout[/color] = store latitude/longitude in HKCU\\Software\\JML\\Comm (timeout=60s per defaut)
[color=red]-status[/color] = store some informations in HKCU\\Software\\JML\\Comm
-data = toggle on/off data-connection
-data:on = switch ON data-connection
-data:off = switch OFF data-connection
-phone = toggle on/off phone
-phone:on = switch ON phone
-phone:off = switch OFF phone
-flight = toggle on/off flight-mode
-flight:on = switch OFF phone, wifi, bluetooth
-flight:off = switch ON phone
-bt = toggle 3 states bluetooth
-bt:on = switch ON bluetooth
-bt:discoverable = switch ON with discoverable mode bluetooth
-bt:off = switch OFF bluetooth
-bt2 = toggle on/off bluetooth
-bt2:on = switch ON bluetooth
-bt2:off = switch OFF bluetooth
-wifi = toggle on/off wifi
-wifi:on = switch ON wifi
-wifi:off = switch OFF wifi
Example : turn OFF bluetooth
Code:
instPath = SystemPath( "ScriptPath" )
RunWait(instPath&"\JMLComm.exe", "-bt:off")
exit
---------------------------------------------------------------------------------
JMLCalendar v2.45
Registry structure:
Code:
[HKEY_CURRENT_USER\Software\JML\[color=green][b]Calendar[/b][/color]]
"total" = dword: number of appointments found
[HKEY_CURRENT_USER Software\JML\[b]Calendar[/b]\Cal[color=orange][b]N[/b][/color]]
"oid" = oid item in poom database
"allday" = 0=FALSE, 1=TRUE
"categories" = list of categories
...
"subject" = subject
Parameters for searching :
Code:
-max:N = maximum number wanted (5 per default)
-days:N = number of days involved (5 per default)
-reg:key = registry key to store ("[color=green][b]Calendar[/b][/color]" per default)
Parameters for appointment :
Code:
-dateview:[color=orange][b]N[/b][/color] = open poutlook.exe to view the appointment number N
-deleteall:end = delete all [b]ended[/b] appointments (except reccurring appointments)
-deleteoid:oid = delete an appointment identified by his oid
-notifyoid:oid = show an appointment identified by his oid
---------------------------------------------------------------------------------
JMLSms v1.80
Registry structure:
Code:
[HKEY_CURRENT_USER\Software\JML\[b]Sms[/b]]
"total" = dword: number of SMS found
[HKEY_CURRENT_USER Software\JML\[b]Sms[/b]\Sms[color=orange][b]N[/b][/color]]
"oid" = oid item in SMS in database
"unread" = 1 if unread SMS, 0 otherwise
...
"subject"= subject
Parameters for searching :
Code:
-max:N = maximum number wanted (5 per default)
-read:all = last all type SMS (last unread per default)
-reg:key = registry key to store ("[color=green]Sms[/color]" per default)
Parameters for sms :
Code:
[color=red]-phone:phone-number[/color] = Call a phone number
-reply:[color=orange][b]N[/b][/color] = Send a response SMS
-reply:[color=orange][b]N[/b][/color] = [color=red]-text:"my text"[/color] = Send a pre-defined text response SMS
-mark:[color=orange][b]N[/b][/color] = Mark as read the SMS
-mark:all = Mark as read all SMS
-markid:oid = Mark as read the SMS identified by his oid
-delete:[color=orange][b]N[/b][/color] = Delete the SMS
-delete:all = Delete all SMS
-delete:unread = Delete all Unread SMS
-deleteid:oid = Delete the SMS identified by his oid
-call:[color=orange][b]N[/b][/color] = Call in response to SMS (in order if exist : sender, mobilePhone, homePhone)
-notify:[color=orange][b]N[/b][/color] = show the SMS
-notifyid:oid = show the SMS identified by his oid
-sms:phone-number = Send a response SMS
-sms:phone-number = [color=red]-text:"my text"[/color] = Send a pre-defined text response SMS
---------------------------------------------------------------------------------
JMLContacts v1.95
Registry structure :
Code:
[HKEY_CURRENT_USER\Software\JML\[b]Contacts[/b]\Anniversaries]
"total" = dword: number of contacts found
[HKEY_CURRENT_USER Software\JML\[b]Contacts[/b]\Anniversary[color=orange][b]N[/b][/color]]
"oid" = oid of Contact in database
...
[b][/b]
"picture"= full path of picture file name (in \My Documents\My Pictures...)
Idem for Favorites : in [HKEY_CURRENT_USER\Software\JML\Contacts\Favorites]
Parameters for searching :
Code:
-max:N = maximum number wanted (5 per default)
-days:N = number of days involved (30 per default)
-reg:key = registry key to store ("[color=green][b]Contacts[/b][/color]" per default)
-anniversaries = search in 'Anniversary' field of contact
-birthdays = search in 'Birthday' field of contact
-anniversaries -birthdays are per default
Parameters for contact :
Code:
[color=red]-call:N[/color] = Call a contact
[color=red]-email:address -account:account[/color] = Send a email from an account-name (Outlook per default)
[color=red]-addfavorite:N[/color] = Add a new favorite contact
[color=red]-removefavorite:N[/color] = Remove a favorite contact
[color=red]-callfavorite:N[/color] = Call a favorite contact
-phone:phone-number = Call phone number
-sms:phone-number = Send SMS to phone number
-smsoid:oid = Send SMS to phone number to contact identified by his oid
---------------------------------------------------------------------------------
JMLMeteo v2.55
Registry structure:
Code:
[HKEY_CURRENT_USER\Software\JML\Meteo]
"total" = dword: number of days found
...
[HKEY_CURRENT_USER Software\JML\Meteo\Current]
...
[HKEY_CURRENT_USER Software\JML\Meteo\DayN]
...
Parameters :
Code:
[color=red]-gps[/color] : acquire gps location (as JMLComm.exe)
-msn:code = city code (ex. : [b]FRXX0016[/b])
-lang:ll-ll = language (en-en per default)
-degree:C = C or F (C per default)
-map:m = number of map to download
-accu:code = city code (ex. : [b]EUR|FR|FR002|BORDEAUX[/b])
-metric: = 1 or 0 (1 per default)
-google:code = city code (ex. : [b]Bordeaux[/b])
-lang:ll = language (en per default)
-degree:C = C or F (C per default)
GPS location with built-in jmlPosition:
Code:
-gps
-accu:[b]jmlPosition[/b]
-metric: = 1 or 0 (1 per default)
OR Acquire GPS-location with JMLComm.exe and next call JMLMeteo with :
Code:
-accu:[b]jmlPosition[/b]
-metric: = 1 or 0 (1 per default)
GPS location with Sleuth's myLocation Service :
- first, install http://forum.xda-developers.com/showthread.php?t=607102
- use it to update Latitude/Longitude coordinates
- next, call JMLMeteo.exe with these parameters :
Code:
-accu:[b]myLocation[/b]
-metric: = 1 or 0 (1 per default)
GPS location with Google Latitude:
- first, copy your googleLatitude account in google.ID file.
- next, call JMLMeteo.exe with these parameters :
Code:
-accu:[b]googleLatitude[/b]
-metric: = 1 or 0 (1 per default)
---------------------------------------------------------------------------------
JMLTasks v1.40
Registry structure:
Code:
[HKEY_CURRENT_USER\Software\JML\[color=green][b]Tasks[/b][/color]]
"total" = dword: number of tasks found
[HKEY_CURRENT_USER Software\JML\[b]Tasks[/b]\Task[color=orange][b]N[/b][/color]]
"oid" = oid item in poom database
"categories" = list of categories
...
"subject" = subject
Parameters for searching :
Code:
-max:N = maximum number wanted (5 per default)
-days:N = number of days involved (5 per default)
-reg:key = registry key to store ("[color=green][b]Tasks[/b]][/color]" per default)
-withCompleted = show all tasks
-sort:due = sort by due tasks
-sort:start = sort by date (per default)
manila = store all tasks in HKEY_LOCAL_MACHINE\Software\HTC\\Manila
Parameters for task :
Code:
-view:[color=orange][b]N[/b][/color] = open poutlook.exe to view the task number N
-delete:[color=orange][b]N[/b][/color] = delete the task number N
-complete:[color=orange][b]N[/b][/color] = complete the task number N
-deleteall:due = delete all [b]due[/b] tasks
-deleteall:completed = delete all [b]completed[/b] tasks
-deleteoid:oid = delete the task identified by his oid
-completeoid:oid = complete the task identified by his oid
---------------------------------------------------------------------------------
JMLFavorites v1.00 (SOON)
Registry structure :
Code:
[HKEY_CURRENT_USER\Software\JML\[b]Favorites[/b]]
[HKEY_CURRENT_USER Software\JML\[b]Favorites[/b]\Favorite[color=orange][b]N[/b][/color]]
"type" = type of favorite : '[color=orange]contact[/color]' or '[color=orange]program[/color]'
"picture"= full path of picture file name
"label"= fistname for contact, filename for program
...
Parameters for favorite :
Code:
-call:N = CALL a contact or RUN a program
-add:N = Add a new favorite (contact per default)
-type:contact = with -add parameter, add a '[color=orange]contact[/color]'
-type:program = with -add parameter, add a '[color=orange]program[/color]'
-remove:N = Remove a favorite
---------------------------------------------------------------------------------
JMLPicture Thank you for offering me a beer. All donations (3€, 5$, +) are appreciated !
Build a picture from multiple images/texts (see picture below).
<Picture...> Parameters :
Code:
[b]Width[/b] result picture with
[b]Height[/b] result picture height
[b]Bkg[/b] initial background color (RGB format)
[b]Transparent[/b] set one color of result picture as transparent (RGB format)
[b]Target[/b] png file name of result picture
[b]Source[/b] png file name of background picture
<Image...> Parameters :
Code:
[b]Left[/b] left-coordinate
[b]Top[/b] top-coordinate
[b]Width[/b] with of displaying picture (with of picture per default)
[b]Height[/b] height of displaying picture (heigh of picture per default)
[b]ScaleStyle[/b]
[b]Alignment[/b]
[b]ID[/b] JMLToday ID ITEM (Page is required)
[b]Page[/b] JMLToday Page ITEM (ID is required)
<Text...> Parameters :
Code:
[b]Left[/b] left-coordinate
[b]Top[/b] top-coordinate
[b]Width[/b] with of displaying text
[b]Height[/b] height of displaying text
[b]Value[/b] text value
[b]FontFamily[/b] font name
[b]FontSize[/b] font size
[b]FontStyle[/b] font style : 'italic', 'bold'
[b]Color[/b] text color (RGB format)
[b]Alignment[/b] 'center', 'right' or 'left' (per default)
[b]ID[/b] JMLToday ID ITEM (Page is required)
[b]Page[/b] JMLToday Page ITEM (ID is required)
Example : ClockText.xml
Code:
<Picture Width="400" Height="200" Bkg="192,192,192" Target="%APPDIR%/ClockText.png">
<Image Left="0" Top="0" ID="BGAMPMALARM" Page="Page1" />
<Image Left="20" Top="40" ID="H1" Page="Page1" />
<Image Left="100" Top="40" ID="H2" Page="Page1" />
<Image Left="225" Top="40" ID="M1" Page="Page1" />
<Image Left="305" Top="40" ID="M2" Page="Page1" />
<Text Left="15" Top="140" Value="AM" Color="128,0,0" FontFamily="Tahoma" FontSize="8" FontStyle="Bold,Italic" />
<Text Left="15" Top="160" ID="City" Page="Page1" FontFamily="Tahoma" FontSize="6" FontStyle="Italic" />
</Picture>
@all : add some program informations ..... in Post#2
A++
Hi.
I sure do love command-line tools! I added them to the Mortscript Source Compendium's list.
And to facilitate my testing them to see if magically they will work with wm5 smartphones, I added a Command-Line tester to The Mortifier. So we can browse to the exe and enter our command line parameters. Keeps the old exe and parameters in memory so you can re-test them easily.
Thanks for these.
Hi.
So i was using Message2reg.exe. It seems with wm653 m2reg gives an error.
I am trying to use jmlsms.exe to see if that can work.
Code:
RunWait(SystemPath("ScriptPath") \ "\Utility\JMLSms.exe","-read:all")
MsgSender = RegRead(HKCU, "\Software\JML\Sms\Sms1", "sender")
MsgBody = RegRead( HKCU,"\Software\JML\Sms\Sms1", "subject")
Think that looks good?
@howdykeith : Yes I think it should work.
StatusTicker and JML...
Hi,
So i incorporated JMLsms.exe and JMLcomm.exe into the StatusTicker.
Works super great!
In future version I will include more of you apps infos... I also will make sure to include the URL to your apps as well.
Thanks much!
Hello,
I'm trying to use JMLContacts.exe to have birthdays on my WAD2 Skin.
I've installed JMLToday and everything worked fine and registry was filled by next 5 birthdays information.
Now I'm trying to update information outside of Titanium/JMLToday and to do it I'm using a mortscript.
Inside script I wrote the following line:
RunWait("\Storage Card\Program Files\UtilsExe\JML\JMLContacts.exe", "-max:3")
Unfortunately it seems not working, at least registry values are not updated. I double checked path and it appears absolutely correct.
More I tried to simply launching JMLContacts.exe directly from TCMD, and I expected it worked with all default values, but of course it didn't... Is my supposition a wrong one?
Meanwhile, thanks a lot to let available for us those little but great tools
@dagosjt :
you must use also -days (0 per default), -birthdays (and /or -anniversaries) parameters
example :
-max:3 -days:365 -birthdays
Ok ? thanks for feedback.
A++
PS : i think i 'll change the default parameters values in a next version...
JMHL said:
@dagosjt :
you must use also -days (0 per default), -birthdays (and /or -anniversaries) parameters
example :
-max:3 -days:365 -birthdays
Ok ? thanks for feedback.
A++
PS : i think i 'll change the default parameters values in a next version...
Click to expand...
Click to collapse
Yes!
Works perfect now I thought days:0 meaning was "all days", sometime it happens in software
HI JMHL
I want to know if JMLMeteo can search for a location based on latitude and longitude
@saeli : not for the moment. Next feature perhaps if more people are interested and if it's easy to hard-coded.
A++
@jmhl: perhaps ypu can use this for location awareness:
forum.xda-developers.com/showthread.php?t=607102
then it could work
Salut
Micha
@Micha : thanks, i look ....
@saeli : ok, weather location based on latitude and longitude certainly in next version.
@micha : thanks for the tips.
A++
JMHL,
Still no HD2 ?
@Zepiii : no. waiting more operator points to change....
A++
@saeli & @all : location based on latitude and longitude in next version of JMLMeteo (in next JMLToday v5.80).
2 ways :
- Sleuth's myLocation Service
- google Latitude
A++
JMHL said:
@saeli & @all : location based on latitude and longitude in next version of JMLMeteo (in next JMLToday v5.80).
2 ways :
- Sleuth's myLocation Service
- google Latitude
A++
Click to expand...
Click to collapse
this is a wery fantastic news
when you think to release new version ?

[EXPERIMENTAL] [PHP SCRIPT] WIFI-MAC Spoofer v1.1

Hi.
I wasn't too sure, if I should post this into the development area, I think it fits more into general.
Introduction
According to this thread, I tried to write a little script which lets one spoof his wi-fi MAC address unindependently from any adb shell or usb connection. It's very experimental and might not work that properly. If I try it at home, my router somehow shuts down any incoming wi-fi connection in the whole network and turns the internet off. :/ But the script itself actually SEEMS to change the MAC address (according to what the wi-fi settings say).
I am not responsible for any damage to your phone. However, you can reset the changed MAC address anyway, if something bad happens.
Please note, that you are only allowed to use this script in those networks where you have the permission to do so. Especially the use of the "MAC takeover" function might be illegal in different networks.
Requirements
You will need SL4A (Android Scripting Environment) and PFA (PHP for Android). Check out: http://www.phpforandroid.net/#requirements
The script
PHP:
<?php
// config: config-file and tmp-file
$cnf = "/etc/wl/nvram.txt";
$tmp = "/sdcard/nvram-tmp.txt";
// this is my very dirty solution to replace the actual config file with a new edited one. root needed. might not work everywhere.
$cmd = 'su -c "mount -o rw,remount -t yaffs2 /dev/block/mtdblock4 /system; mv -f \"'.$tmp.'\" \"'.$cnf.'\"; chmod 644 \"'.$cnf.'\"; mount -o ro,remount -t yaffs2 /dev/block/mtdblock4 /system"';
// access android api
require_once("Android.php");
$droid = new Android();
// get config file src
$src = file_get_contents($cnf);
// check, if mac address was already spoofed before
preg_match("|macaddr=([a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2})|i", $src, $res);
$spoofed = false;
$macaddr = "13:57:9B:DF:13:37";
if(isset($res[1]))
{
$spoofed = true;
$macaddr = $res[1];
}
// pre-configurations
$title = "LG-OO-P500 MAC Spoofer";
$action = "start";
// main loop for actions
while(true)
{
switch($action)
{
// start
case "start":
$msg = "Your MAC address is currently set on default.";
// currently spoofed mac address?
if($spoofed)
{
$msg = "Your currently spoofed MAC address is: ".$macaddr;
}
$droid->makeToast($msg);
// create dialog
$droid->dialogCreateAlert($title);
$droid->dialogSetItems(array("Change MAC address", "MAC takeover", "Reset MAC address", "Exit"));
$droid->dialogShow();
// determine next action
$res = $droid->dialogGetResponse();
$actions = array("spoof", "scan", "reset", "exit");
$action = $actions[$res["result"]->item];
$droid->dialogDismiss();
break;
// spoof and reset action
case "spoof": case "scan": case "reset":
// get user input for new mac addr
switch($action)
{
case "spoof":
while(true)
{
$res = $droid->dialogGetInput($title, "Insert new MAC address", $macaddr);
$macaddr = strtoupper($res["result"]);
if(preg_match("|[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}|i", $macaddr))
{
break;
}
$droid->makeToast("Invalid MAC address. (example: 00:00:00:00:00:00 to FF:FF:FF:FF:FF:FF)");
}
$rpl = "macaddr=".$macaddr;
break;
case "scan":
$droid->dialogCreateSpinnerProgress("Now scanning network...");
// scan for MACs and filter ip and MAC addresses from the output
exec("arp -a", $out);
preg_match_all("|\(([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\) at ([a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2})|i", strtoupper(implode("\r\n", $out)), $res);
$droid->dialogDismiss();
// create new array
$arr = array();
for($i = 0; $i != count($res[1]); $i++)
{
$arr["list"][] = $res[1][$i]."\n=> ".$res[2][$i];
$arr["ip"][] = $res[1][$i];
$arr["mac"][] = $res[2][$i];
}
$droid->dialogCreateAlert("Found ".count($arr)." individuals... please choose:");
$droid->dialogSetItems($arr["list"]);
$droid->dialogShow();
$res = $droid->dialogGetResponse();
$rpl = "macaddr=".$arr["mac"][$res["result"]->item];
break;
case "reset": default:
$rpl = null;
break;
}
// edit src
($spoofed || empty($rpl)) ? $src = rtrim(preg_replace("|macaddr=.*|i", $rpl, $src)) : $src = rtrim($src)."\n".$rpl;
// disable wifi
$droid->toggleWifiState(false);
// save tmp file
$h = fopen($tmp, "w");
fwrite($h, $src);
fclose($h);
// overwrite with root privileges
exec($cmd);
$droid->makeToast("Operation complete.");
$action = "exit";
break;
// exit
case "exit":
// enable wlan and exit
$droid->toggleWifiState(true);
$droid->exit();
exit();
break;
}
}
I am really not sure, if it is going to work for you. I tested it under devoid #forever (CM7, 2.3.4). Maybe other ROMs and other smartphones are going to behave different. And to be honest, for me it didn't work that good either until now.
If you are having trouble, you can also try to reboot after spoofing.
Have fun trying.
Is this all this about adding macaddr in nvram.txt as we had this discussion earlier.
Nice work.
Sent from my LG-P500 using XDA Premium App
I added another very experimental function which I named "MAC takeover". It allows the user to scan the network for all connected MAC addresses and afterwards display and finally spoof one of those addresses.
The whole script might be buggy, so tell me if something doesn't work properly.
Please note, that you are only allowed to use this script in those networks where you have the permission to do so. Especially the use of the "MAC takeover" function might be illegal in different networks.
See the changes above in the source code.
Is this all this about adding macaddr in nvram.txt as we had this discussion earlier.
Click to expand...
Click to collapse
Yup, but it makes things a lot easier, because you just need your phone to change the MAC address. Additionally it has something like an interface.
I have a bash script somewhere doing the same (except for takeover... nasty boy ). Will post it when I find it. Should be a hell lot easier to use (just bash, no weird stuff needed.)
This is actually quite easy as well, you just need PHP installed on android. However, I'm also very interested in that bash script, please share!

galaxy ace secret codes and test codes

FIRMWARE VERSION INFORMATION
*#*#1234#*#* - PDA and Phone
*#*#1111#*#* - FTA SW Version
*#*#2222#*#* - FTA HW Version
*#*#44336#*#* - PDA, Phone, CSC, Build Time, Changelist number
*#*#4636#*#*-This code is used to get various information about your phone and battery. It shows following 4 menus on screen:
Phone information
Battery information
Battery history
Usage statistics
*#*#7780#*#*-Factory data reset.It REMOVES:
Google account settings
System and application data and settings
Downloaded applications
It DOES NOT REMOVE:
system software and bundled applications
SD card files
*2767*3855#-WARNING:Factory Reset.This code is used for factory format. It'll remove all files and settings including the internal memory storage. It'll also reinstall the phone firmware.
*#*#273283*255*663282*#*#*-This code opens a File copy screen where you can backup your media files e.g. Images, Sound, Video and Voice memo.
*#*#8255#*#*-This code can be used to launch GTalk Service Monitor.
WLAN, GPS and Bluetooth Test Codes:
*#*#232339#*#* OR *#*#526#*#* OR *#*#528#*#* - WLAN test (Use "Menu" button to start various tests)
*#*#232338#*#* - Shows WiFi MAC address
*#*#1472365#*#* - GPS test
*#*#1575#*#* - Another GPS test
*#*#232331#*#* - Bluetooth test
*#*#232337#*# - Shows Bluetooth device address
VARIOUS FACTORY TESTS
*#*#0283#*#* - Packet Loopback
*#*#0*#*#* - LCD test
*#*#0673#*#* OR *#*#0289#*#* - Melody test
*#*#0842#*#* - Device test (Vibration test and BackLight test)
*#*#2663#*#* - Touch screen version
*#*#2664#*#* - Touch screen test
*#*#0588#*#* - Proximity sensor test
*#*#3264#*#* - RAM version
UPDATE 18/06/2012
ALL SAMSUNG UNLOCK CODE....
---------------------------
*2767*688# = Unlocking Code
*#8999*8378# = All in one Code
*#4777*8665# = GPSR Tool
*#8999*523# = LCD Brightness
*#8999*3825523# = External Display
*#8999*377# = Errors
#*5737425# = JAVA Something{I choose 2 and it chrashed}][/b]
*#2255# = Call List
#*536961# = Java Status Code
#*536962# = Java Status Code
#*536963# = Java Status Code
#*53696# = Java Status Code
#*1200# = AFC DAC Val
#*1300# = IMEI
#*1400# = IMSI
#*2562# = ??? White for 15 secs than restarts.
#*2565# = Check Blocking
#*3353# = Check Code
#*3837# = ??? White for 15 secs than restarts.
#*3849# = ??? White for 15 secs than restarts.
#*3851# = ??? White for 15 secs than restarts.
#*3876# = ??? White for 15 secs than restarts.
#*7222# = Operation Typ (Class C GSM)
#*7224# = I Got !! ERROR !!
#*7252# = Operation Typ (Class B GPRS)
#*7271# = Multi Slot (Class 1 GPRS)
#*7274# = Multi Slot (Class 4 GPRS)
#*7276# = Dunno
#*7337# = EEPROM Reset (Unlock and Resets Wap Settings)
#*2787# = CRTP ON/OFF
#*3737# = L1 Dbg data
#*5133# = L1 Dbg data
#*7288# = GPRS Attached
#*7287# = GPRS Detached
#*7666# = SrCell Data
#*7693# = Sleep Act/DeAct (Enable or Disable the Black screen after doing nothing for a while)
#*7284# = Class : B,C or GPRS
#*2256# = Calibration Info
#*2286# = Battery Data
#*2527# = GPRS Switching (set to: class 4, class 8, class 9 or class 10)
#*2679# = Copycat feature (Activate or Deactivate)
#*3940# = External loop test 9600 bps
#*4263# = Handsfree mode (Activate or Deactivate)
#*4700# = Half Rate (Activate or Deactivate)
#*7352# = BVMC Reg value
#*8462# = Sleeptime
#*2558# = Time ON
#*3370# = EFR (Activate or Deactivate)
#*3941# = External looptest 115200 bps
#*5176# = L1 Sleep
#*7462# = SIM phase
#*7983# = Voltage/Frequenci (Activate or Deactivate)
#*7986# = Voltage (Activate or Deactivate)
#*8466# = Old time
#*2255# = Call ???
#*5187# = L1C2G trace (Activate or Deactivate)
#*5376# = ??? White for 15 secs than restarts.
#*6837# = Official Software Version
#*7524# = KCGPRS
#*7562# = LOCI GPRS
#*7638# = RLC allways open ended TBF (Activate or Deactivate)
#*7632# = Sleep mode Debug
#*7673# = Sleep mode RESET
#*2337# = Permanent Registration Beep
#*2474# = ???
#*2834# = Audio Path
#*3270# = DCS support (Activate or Deactivate)
#*3282# = Data (Activate or Deactivate)
#*3476# = EGSM (Activate or Deactivate)
#*3676# = Flash volume formated
#*4760# = GSM (Activate or Deactivate)
#*5171# = L1P1
#*5172# = L1P2
#*5173# = L1P3
#*7326# = Accessory (I got Vibrator)
#*7683# = Sleep variable (8)
#*7762# = SMS Brearer CS (Activate or Deactivate)
#*8465# = Time in L1
#*9795# = wtls key
#*2252# = Current CAL
#*2836# = AVDDSS Management (Activate or Deactivate)
#*3877# = Dump of SPY trace
#*7728# = RSAV done# (Everything went to standart but nothing was deleted)
#*2677# = ARM State (None or Full Rate)
*#8999*636# = Have no clue what it is, i see 20 lines
*#9999# = Software version
*#8999*8376263# = HW ver, SW ver and Build Date
*#8888# = HW version
*#8377466# = Same HW/SW version thing
*#7465625# = Check the locks
*7465625*638*Code# = Enables Network lock
#7465625*638*Code# = Disables Network lock
*7465625*782*Code# = Enables Subset lock
#7465625*782*Code# = Disables Subset lock
*7465625*77*Code# = Enables SP lock
#7465625*77*Code# = Disables SP lock
*7465625*27*Code# = Enables CP lock
#7465625*27*Code# = Disables CP lock
*7465625*746*Code# = Enables SIM lock
#7465625*746*Code# = Disables SIM lock
*7465625*228# = Activa lock ON
#7465625*228# = Activa lock OFF
*7465625*28638# = Auto Network lock ON
#7465625*28638# = Auto Network lock OFF
*7465625*28782# = Auto subset lock ON
#7465625*28782# = Auto subset lock OFF
*7465625*2877# = Auto SP lock ON
#7465625*2877# = Auto SP lock OFF
*7465625*2827# = Auto CP lock ON
#7465625*2827# = Auto CP lock OFF
*7465625*28746# = Auto SIM lock ON
#7465625*28746# = Auto SIM lock OFF
*2767*3855# = E2P Full Reset
*2767*2878# = E2P Custom Reset
*2767*927# = E2P Wap Reset
*2767*226372# = E2P Camera Reset
#*6420# = MIC Off
#*6421# = MIC On
#*6422# = MIC Data
#*6428# = MIC Measurement
#*3230# = Trace enable and DCD disable
#*3231# = Trace disable and DCD enable
#*3232# = Current Mode
#7263867# = RAM Dump (On or Off)
*2767*49927# = Germany WAP Settings
*2767*44927# = UK WAP Settings
*2767*31927# = Netherlands WAP Settings
*2767*420927# = Czech WAP Settings
*2767*43927# = Austria WAP Settings
*2767*39927# = Italy WAP Settings
*2767*33927# = France WAP Settings
*2767*351927# = Portugal WAP Settings
*2767*34927# = Spain WAP Settings
*2767*46927# = Sweden WAP Settings
*2767*380927# = Ukraine WAP Settings
*2767*7927# = Russia WAP Settings
*2767*30927# = GREECE WAP Settings
*2767*73738927# = WAP Settings Reset
*2767*49667# = Germany MMS Settings
*2767*44667# = UK MMS Settings
*2767*31667# = Netherlands MMS Settings
*2767*420667# = Czech MMS Settings
*2767*43667# = Austria MMS Settings
*2767*39667# = Italy MMS Settings
*2767*33667# = France MMS Settings
*2767*351667# = Portugal MMS Settings
*2767*34667# = Spain MMS Settings
*2767*46667# = Sweden MMS Settings
*2767*380667# = Ukraine MMS Settings
*2767*7667#. = Russia MMS Settings
*2767*30667# = GREECE MMS Settings
*335# = Delete all MMS Messages
*663867# = Dump Mm file
#*536961# = WAPSAR enable / HTTP disable
#*536962# = WAPSAR disable / HTTP enable
#*536963# = Serial eable / Others disable
#*53696# = Java Download Mode
#*5663351# = Wap Model ID [Your Model]
#*5663352# = Wap Model ID [SEC-SGHXXXX/1.0]
#*566335# = Wap Model ID [SEC-SGHXXXX/1.0]
*2767*66335# = Check on which model it is
*2767*7100# = SEC-SGHS100/1.0
*2767*8200# = SEC-SGHV200/1.0
*2767*7300# = SEC-SGHS300/1.0
*2767*7650# = Nokia7650/1.0
*2767*2877368# = Reset WAP Model ID to standart
I hope you enjoy it
DO ANYTHING AT YOUR OWN RISK!
IF YOU DO NOT KNOW WHAT YOU ARE DOING PLS DO NOT DO IT!
I never knew there were so many codes!
Thanks!
Sent from my GT-S5830 using Tapatalk 2
i will update it as soon as i find some more working
i have a file full of codes but i have to tes them before post
in 1 or 2 days it will be updated
thankyou brother
do you know how to change regional with a screet code?
sorry for my bad english
what do you mean by regional?
you need sim unlock code?or something else?
stealthware said:
thankyou brother
do you know how to change regional with a screet code?
sorry for my bad english
Click to expand...
Click to collapse
*272*yourimeinumber#
You cam find your imei with this code.
*#06#
Sent from my GT-S5830 using Tapatalk 2
Awesome
Thanks
kumicho said:
what do you mean by regional?
you need sim unlock code?or something else?
Click to expand...
Click to collapse
not sim unlock code, but the regional restore for readability if there is an update on Kies
for example the base regional ddkq8 is indan firmware, i want to regional indonesian is xse. without replacing the firmware can be used a screet code
sorry for bad english
---------- Post added at 03:24 PM ---------- Previous post was at 03:21 PM ----------
galaxyace152 said:
*272*yourimeinumber#
You cam find your imei with this code.
*#06#
Sent from my GT-S5830 using Tapatalk 2
Click to expand...
Click to collapse
thankyou brother for info
like it
great
thanks for that thorough list of codes, this might come in handy sometime!
Thanks for the huge collection.
Sent from my GT-S5830 using Tapatalk 2
factory data reset
It is an awesome list you gave us. Thanx
I just want to know...if i type *#*#7780#*#* it will leave my cell phone as when i took it out of the box??
or is it the one with *2767*3855#? and will it restore apps i erased with root superuser??
thanks
Great...but
These codes posted are definitely a great collection, wonderful I would say. But beware, some websites may utilise these code to hack your phone. Like for example, the website may just dial one of the reset codes and reset the entire phone. This is definitely not a very great experience. There is a solution thou, by installing a third party dialer to prevent these codes from executing.
stevenkyk said:
These codes posted are definitely a great collection, wonderful I would say. But beware, some websites may utilise these code to hack your phone. Like for example, the website may just dial one of the reset codes and reset the entire phone. This is definitely not a very great experience. There is a solution thou, by installing a third party dialer to prevent these codes from executing.
Click to expand...
Click to collapse
Elaborate on how we can protect ourselves from said threat.
Sent from my GT-S5830 using xda app-developers app

[Q] What the correct way to read from thumb_image column on messages table (Whatsapp)

Hi all,
I build a software for myself that read from Whatsapp db (that stored on my android device)..
I trying to read from thumb_image column but cannot find the correct way ...
I write this software on c# language... and the code for read its column as follows:
//thumbImage is the value that stored in thumb_image column.
byte[] encodedbytes = System.Text.Encoding.Unicode.GetBytes(thumbImage);
string encoded = System.Convert.ToBase64String(encodedbytes);
byte[] utf8Decoded = System.Text.Encoding.UTF8.GetBytes(encoded);
File.WriteAllBytes("Images\\" + mdeiaName, utf8Decoded);
but it's not working, so i trying to use IronPython as following:
string pythonScript = @"import base64
class DecryptString(object):
def Decrypt(self, str):
return base64.b64encode(str).decode(""utf-8"")";
ScriptEngine engine = Python.CreateEngine();
ScriptSource source = engine.CreateScriptSourceFromString(pythonScript);
ScriptScope scope = engine.CreateScope();
source.Execute(scope);
dynamic DecryptString = scope.GetVariable("DecryptString");
dynamic decryptString = DecryptString();
var result = decryptString.Decrypt(thumbImage);
File.WriteAllText("Images\\" + mdeiaName, result);
but without success...
Can somebody help me?

[Ugoos X3 and probably a lot of other devices, and even NAS devices] [Solved] Why samba/smb transfer rate is slow despite a gigabit Ethernet port ?

Hello everyone,
For my first thread, I won't ask a question, I will post a solution.
I have recently acquired a second-hand Ugoos X3 device, which is quite a good device.
But I have been really frustrated upon testing it after unboxing it, because despite the fact that this device advertises for the ability of having a Gigabit ethernet port and a builtin samba server, my tests showed a max 11,4 MiB/s instead of rather a 114 MiB/s.
I started to identify the reason, with a vast amount of Googling. After realizing how many people on earth already been through this (mostly unsolved) issue, and after testing the good gigabit-readiness of my Ethernet cable, I dug into the rabbit hole of the system.
I then discovered the root causes, and you won't like it :
- the smbd binary dates from 2005
- the smb.conf is counter-optimized and dates from this 2005 era
See for yourself:
Code:
/data/system/samba_________________ug # ./smbd -V
Version 3.0.20a
Code:
[global]
interfaces = wlan0 eth0 eth1 eth2
min protocol = SMB2
bind interfaces only = yes
workgroup = WORKGROUP
server string = Samba on Android mediacenter
netbios name = mybox
#remote announce = 255.255.255.255
encrypt passwords = yes
security = SHARE
restrict anonymous = 0
load printers = no
printcap name = /dev/null
disable spoolss = yes
deadtime = 5
delete readonly = yes
nt acl support = no
inherit permissions = yes
socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=64000 SO_RCVBUF=64000 SO_KEEPALIVE
local master = no
unix extensions = yes
[internal storage]
vfs objects = fake_perms
comment = mybox /sdcard
path = /sdcard
force user = root
read only = no
writable = yes
guest ok = yes
A lot of directives in this config file are totally deprecated, and the "socket options" is responsible for capping at 11,4 MiB/s.
So after having spent this vast amount of time finding the issue, I took some to patch.
Here's my solution.
0) Root your device
1) Download the Termux compiled package of your device architecture of the "samba" package : https://grimler.se/termux-packages-24/pool/main/s/samba/
2) On your device, replace the smbd binary with the Termux one, at this location : "/data/system/samba_________________ug"
3) Replace the original "smb.conf" (same directory than previous) configuration with this one (which by way the contains security hardening features and support SMBv2 which allows not installing SMBv1 on Windows...)
Code:
[global]
lock dir = /data/local/tmp/lock/
state directory = /data/local/tmp/state/
ncalrpc dir = /data/local/tmp/ncalrpc/
interfaces = wlan0 eth0 eth1 eth2
server min protocol = SMB2
bind interfaces only = yes
workgroup = WORKGROUP
server string = Samba on Android mediacenter
netbios name = mybox
server role = standalone server
security = user
map to guest = Bad Password
usershare allow guests = yes
load printers = no
printcap name = /dev/null
disable spoolss = yes
deadtime = 5
delete readonly = yes
nt acl support = no
inherit permissions = yes
local master = no
disable netbios = yes
smb ports = 445
lm announce = no
multicast dns register = no
[internal storage]
vfs objects = fake_perms
comment = mybox /sdcard
path = /sdcard
force user = root
read only = no
writable = yes
guest ok = yes
4) Edit the "smbd" binary calling line in the "samba-rc" launching script, with this one
Code:
$PRE/smbd -D -s /data/system/samba_________________ug/smb.conf
Reboot your device, you now have a best-of-breed samba server and configuration.
A simple but heartful message to Ugoos: update the packages you use in your image ! We need more up-to-date binaries and configuration from your products ! Provide firmwares that does not require to make people do insecure stuff such as installing SMBv1 client on their client !
I am really grateful to these resources which helped a lot:
- https://lafibre.info/nas/perfs-moisies-avec-samba/ (sorry, in french, use google translate)
- https://serverfault.com/questions/470650/samba-configuration-for-public-shares/700449#700449
- https://blog.hiebl.cc/posts/why-your-samba-config-does-not-work/
Hello. According to your instructions with file replacement and line editing, the server becomes inoperable. The server activation checkbox is not activated in the ugoos settings. Please describe the actions in more detail or upload files for replacement.
Hello @Nereal-NeSkill,
As of step 1), try to perform a "pkg install samba" first with Termux.
Then, can you perform a "./samba-rc start" and paste here the output ?
Was a bit skeptical replacing daemon but It works great!

Categories

Resources