HI, I want to use the RPi as part of a home security system, basically to send me email alerts with jpg images triggered by a PIR sensor.
I have 3 questions:
1. I know how to take a test jpg image using
Code:
raspistill -o testshot.jpg
But can you tell me how to view these test images?
2. will the following piece of code delete all jpg images from the RPI sd card?
Code:
rm *.jpg
3. When the PIR triggers an email alert and emails the jpg images, could a line of code be inserted into the following python script to automatically delete the images after they have been emailed, so as to avoid a large accumulation of images on the sd card?
This is the python script, which I think I got from: https://circuitdigest.com/microcontroller-projects/raspberry-pi-iot-intruder-alert-system
Code:
#!/usr/bin/env python3
import RPi.GPIO as gpio
import picamera
import time
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email import encoders
from email.mime.image import MIMEImage
fromaddr = "email_address " # change the email address accordingly
toaddr = "other_email_address " # change the email address accordingly
mail = MIMEMultipart()
mail['From'] = fromaddr
mail['To'] = toaddr
mail['Subject'] = "Attachment"
body = "Please find the attachment"
led=17
pir=18
HIGH=1
LOW=0
gpio.setwarnings(False)
gpio.setmode(gpio.BCM)
gpio.setup(led, gpio.OUT) # initialize GPIO Pin as outputs
gpio.setup(pir, gpio.IN) # initialize GPIO Pin as input
data=""
def sendMail(data):
mail.attach(MIMEText(body, 'plain'))
print data
dat='%s.jpg'%data
print dat
attachment = open(dat, 'rb')
image=MIMEImage(attachment.read())
attachment.close()
mail.attach(image)
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(fromaddr, "*********")
text = mail.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
def capture_image():
data= time.strftime("%d_%b_%Y|%H:%M:%S")
camera.start_preview()
time.sleep(5)
print data
camera.capture('%s.jpg'%data)
camera.stop_preview()
time.sleep(1)
sendMail(data)
gpio.output(led , 0)
camera = picamera.PiCamera()
camera.rotation=180
camera.awb_mode= 'auto'
camera.brightness=55
while 1:
if gpio.input(pir)==1:
gpio.output(led, HIGH)
capture_image()
while(gpio.input(pir)==1):
time.sleep(1)
else:
gpio.output(led, LOW)
time.sleep(0.01)
Thanks
Related
I have a problem in setting controls in a Win32 application.
When I use SendMessage to set a text string in a static control I get error number 120 which translated means: "This function is only valid in Win32 mode."
Here's the background:
I'm using Visual Studio 2005, I've installed the Windows Mobile 5 SDK.
The project was created using the New Project Wizard, with the following settings:
Visual C++/Smart Device
Win32 Smart Device Project
Platform SDK is: Windows Mobile 5.0 Pocket PC SDK
Windows application
I've added a dialog template resource and can bring up a dialog based on that resource. It contains a static control that I can read the text from, but attempting to set the text gives me the above error.
The relevent code (within the WM_INITDIALOG message handler) is:
Code:
char buffer[100];
HWND hCtrl = ::GetDlgItem(hDlg, IDC_TITLE);
LRESULT result = ::SendMessage(hCtrl, WM_GETTEXT, (WPARAM)80, (LPARAM)buffer);
This works, I get the correct text (ie the text I have placed into the static control using the dialog template editor) copied into the buffer. What follows is:
Code:
buffer[0] = 'A'; // Just to set up a different string
result = ::SendMessage(hCtrl, WM_SETTEXT, (WPARAM)0, (LPARAM)buffer);
if (result == 0)
{
LPVOID lpMsgBuf;
DWORD error = ::GetLastError();
::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, 0, (LPTSTR)&lpMsgBuf, 0, NULL);
::MessageBox(NULL, (LPCTSTR)lpMsgBuf, (LPCWSTR)"LError", MB_OK | MB_ICONINFORMATION);
::LocalFree(lpMsgBuf);
}
The attempt to set the changed text string fails (ie result == 0), and the last error is 120, which is translated to the error message above.
This works the same in both the Windows Mobile 5 emulator, and if I run it on my Atom.
What does this mean? How could it be anything other than Win32 mode?
Is there a function or something I have to call to put it into Win32 mode?
Or is it a project setting in VS2005 that I haven't been able to find?
I'd very much appreciate any help on this.
Peter
Your build target was a PPC 2003 variant for this project, correct? If so (and I'm assuming that it is so because you mention trying this on the PPC emulator), then you are most certainly not in Win32 mode, rather you are targeting WinCE. To target win32, you need to go into configuration manager and change your target at which point your program will no longer run on PPC.
More to your problem: I don't believe that you can dynamically change dialog static control properties through messaging on WinCE. I may be wrong on this here though too....
for us use chinese, is there anybody can help to fix to sort&search Chinese in contacts&dial up on Nexus one or Android 2.1 ?
HTC, can search contact when input number in dial up. CM Rom can not .
http://www.androidin.net/bbs/thread-49607-1-1.html
http://www.androidin.net/bbs/viewthread.php?tid=46916&highlight=
yungjoe said:
http://www.androidin.net/bbs/viewthread.php?tid=46916&highlight=
Click to expand...
Click to collapse
thanks a lot. and i made this post, not perfect ^_^
http://www.androidin.net/bbs/thread-49607-1-1.html
but i meet some problem that i can not search chiese name by english alphabet. HTC Hero's contacts is good, any one ported ?
*** link deleted ***
hengsin said:
http://www.tigersw.cn/soft15633.html
Click to expand...
Click to collapse
please remove the link or prepared to be banned
Sorry to go off-topic, but why will he be banned because of the link? Non-English?
by replace the libsqlite.so libcudata.so can display sorted chinese contact .
below is the way to add function search by name, but it is for android 1.6. I found the contacts.db is different from Android 2.1.
no "pepole persons contact_methods" tables
only "contacts name_lookup phone_lookup"
i did not understand the co-relation beside these tables, some guy can help to change below scripts on Android 2.1 ??
Thanks very much.
Android 2.1 contacts2.db
PHP:
sqlite> .tables
.tables
_sync_state status_updates
_sync_state_metadata v1_settings
activities view_contacts
agg_exceptions view_contacts_restricted
android_metadata view_data
calls view_data_restricted
contact_entities_view view_groups
contact_entities_view_restricted view_raw_contacts
contacts view_raw_contacts_restricted
data view_v1_contact_methods
groups view_v1_extensions
mimetypes view_v1_group_membership
name_lookup view_v1_groups
nickname_lookup view_v1_organizations
packages view_v1_people
phone_lookup view_v1_phones
raw_contacts view_v1_photos
settings
sqlite> .schema contacts
.schema contacts
CREATE TABLE contacts (_id INTEGER PRIMARY KEY AUTOINCREMENT,display_name TEXT,p
hoto_id INTEGER REFERENCES data(_id),custom_ringtone TEXT,send_to_voicemail INTE
GER NOT NULL DEFAULT 0,times_contacted INTEGER NOT NULL DEFAULT 0,last_time_cont
acted INTEGER,starred INTEGER NOT NULL DEFAULT 0,in_visible_group INTEGER NOT NU
LL DEFAULT 1,has_phone_number INTEGER NOT NULL DEFAULT 0,lookup TEXT,status_upda
te_id INTEGER REFERENCES data(_id),single_is_restricted INTEGER NOT NULL DEFAULT
0);
CREATE INDEX contacts_has_phone_index ON contacts (has_phone_number);
CREATE INDEX contacts_restricted_index ON contacts (single_is_restricted);
CREATE INDEX contacts_visible_index ON contacts (in_visible_group,display_name C
OLLATE LOCALIZED);
CREATE TRIGGER contacts_times_contacted UPDATE OF last_time_contacted ON contact
s BEGIN UPDATE contacts SET times_contacted = (new.times_contacted + 1) WHERE _i
d = new._id;END;
sqlite> .schema name_lookup
.schema name_lookup
CREATE TABLE name_lookup (data_id INTEGER REFERENCES data(_id) NOT NULL,raw_cont
act_id INTEGER REFERENCES raw_contacts(_id) NOT NULL,normalized_name TEXT NOT NU
LL,name_type INTEGER NOT NULL,PRIMARY KEY (data_id, normalized_name, name_type))
;
CREATE INDEX name_lookup_index ON name_lookup (normalized_name,name_type, raw_co
ntact_id);
CREATE INDEX name_lookup_raw_contact_id_index ON name_lookup (raw_contact_id);
sqlite> .schema phone_lookup
.schema phone_lookup
CREATE TABLE phone_lookup (data_id INTEGER PRIMARY KEY REFERENCES data(_id) NOT
NULL,raw_contact_id INTEGER REFERENCES raw_contacts(_id) NOT NULL,normalized_num
ber TEXT NOT NULL);
CREATE INDEX phone_lookup_index ON phone_lookup (normalized_number,raw_contact_i
d,data_id);
PHP:
echo 'Phase 1: Creating triggers...'
#Replace the offical trigger to index email address
sqlite3 contacts.db "DROP TRIGGER IF EXISTS peopleLookup_update;"
sqlite3 contacts.db \
"CREATE TRIGGER peopleLookup_update \
UPDATE OF name ON people \
BEGIN\
DELETE FROM peopleLookup WHERE source = new._id;\
SELECT _TOKENIZE('peopleLookup', new._id, new.name, ' ');\
SELECT _TOKENIZE('peopleLookup', new._id, data, '')\
FROM contact_methods\
WHERE person=new._id AND kind=1; \
END"
# Trig the peopleLookup_updats trigger
sqlite3 contacts.db "DROP TRIGGER IF EXISTS sunner_email_update;"
sqlite3 contacts.db \
"CREATE TRIGGER IF NOT EXISTS sunner_email_update \
AFTER UPDATE OF data ON contact_methods \
WHEN new.kind=1 \
BEGIN \
UPDATE people SET name=\`name\` WHERE _id=new.person; \
END"
sqlite3 contacts.db \
"CREATE TRIGGER IF NOT EXISTS sunner_email_insert \
AFTER INSERT ON contact_methods \
WHEN new.kind=1 \
BEGIN \
SELECT _TOKENIZE('peopleLookup', new.person, new.data, ''); \
END"
I've been stuck for a while now, trying to add some new functionality (day counter) to an existing apk (widget).
What I've done so far:
- unpacked the apk using apktool (using apktool d -d)
- start new project in netbeans with the specific source
- adding the java class to the existing package
The java code introduces some new parameters. I've added the parameters to different xml's. When I try to rebuild I keep getting the message:
cannot find symbol
symbol : variable layout
location: class fr.gdi.android.news.R
remoteViews = new RemoteViews(context.getPackageName(), R.layout.main);
Can anyone give me a hint what to do?
some additional info. This is the class I'm trying to add:
Code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fr.gdi.android.news;
/**
*
* @author John
*/
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Timer;
import java.util.TimerTask;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.widget.RemoteViews;
public class CountDays extends AppWidgetProvider {
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
Timer timer = new Timer();
timer.scheduleAtFixedRate(new MyTime(context, appWidgetManager), 1, 60000);
}
private class MyTime extends TimerTask {
RemoteViews remoteViews;
AppWidgetManager appWidgetManager;
ComponentName thisWidget;
public MyTime(Context context, AppWidgetManager appWidgetManager) {
this.appWidgetManager = appWidgetManager;
remoteViews = new RemoteViews(context.getPackageName(), R.layout.main);
thisWidget = new ComponentName(context, CountDays.class);
}
@Override
public void run() {
Date date1 = new Date();
Calendar calendar = new GregorianCalendar(2010, 11,25);
long days = (((calendar.getTimeInMillis()- date1.getTime())/1000))/86400;
remoteViews.setTextViewText(R.id.days,""+ days);
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
}
}
}
1. Apktool does not support writing your code in Java right now. Whole story is here: http://code.google.com/p/android-apktool/issues/detail?id=88 . If you want to use Java, it's possible, but you will have to use a workaround. It's not that hard to implement, but requires you to understand, how Java/javac/bytecode works. Workaround is described in above link, if you don't want to read full story, instructions start at "My script is here".
2. I think (but maybe I'm wrong) that you misunderstand, how R references work. These R.drawables.xxx strings aren't magically converted to resIDs at compile or run time. To use them you have to generate proper R class using SDK. If you use Eclipse or Netbeans, you don't have to do that, cause IDE regenerates R.java file each time you modify something in resources, so you can use R references in your code whenever you want.
In app decoded by apktool you have to manage resIDs manually. It's caused by the fact, that if you want to use some resources in smali, you can't let SDK generate ids for these resources automatically, cause resIDs are stored in smali in numerical form, i.e. "const v0, 0x7f012345", not something like "const v0, R.drawables.xxx". So if you would add e.g. "const v0, 0x7f012345" line to smali and resIDs would be regenerated, your line might reference other resource, that you want.
Of course that's not the case if you want to use resources from Java code, but as I said, this feature isn't fully supported by apktool. Also I think it would be good to add possibility to generate resIDs automatically, even for smali code, cause managing resIDs manually is very inconvenient. But that's future.
For now if you want to add new resource and use it from your Java/smali code, you have to modify public.xml file, add that resource with next free resID and then use that resID from your code.
If you want to know more, you could read this: http://forum.xda-developers.com/showthread.php?p=7380557#post7380557
@Brut.all: Thanks for your extensive answer! I will read the stuff you mention and get back at it.
@Brut.all: I think you're right about me not understanding R.java completely. But what I understand from your story is this. When I want a new resource to use in a new class and to be used in the existing xml, I would have to do the following:
- add a line to the res/values/ids.xml, for example:
Code:
<item type="id" name="main">false</item>
- add a line to the res/values/public.xml, for example:
Code:
<public type="id" name="main" id="0x7f0a0034" />
- add a line to the R$id.java and R$layout.java (don't exactly know which one)
Code:
.field public static final main:I = 0x7f0a0034
first: is this correct? second: How can I refer to the newly added resource in my new class. R.layout.main doesn't work, R$layout.main doesn't work.
Code:
remoteViews = new RemoteViews(context.getPackageName(), R$layout.main);
john37 said:
- add a line to the res/values/ids.xml, for example:
Code:
<item type="id" name="main">false</item>
Click to expand...
Click to collapse
You don't have to do that. If you add new drawable, XML or @+id/something value, then it's ok.
john37 said:
- add a line to the res/values/public.xml, for example:
Code:
<public type="id" name="main" id="0x7f0a0034" />
Click to expand...
Click to collapse
Yes.
john37 said:
- add a line to the R$id.java and R$layout.java (don't exactly know which one)
Code:
.field public static final main:I = 0x7f0a0034
Click to expand...
Click to collapse
No ;-)
If you want to use these resources in smali, then you could use them as is, e.g.: "const v0, 0x7f0a0034".
If you want to use my workaround to work in Java, then you could do the same, as above, e.g.:
Code:
int id = 0x7f0a0034;
or you could do this cleaner and generate R class manually: remove all existing R*.java classes (they aren't used) and create single R.java file:
Code:
public final class R {
public static final class id {
public static final int main = 0x7f0a0034;
}
}
and then you could use it as "R.id.main" in your code.
But first you have to implement workaround to use any Java code.
@Brut.all: thanks again for your reply. I think I didn't understand your previous story fully. I am 'developing' on windows, so your workaround is going to be tricky. Do you know if anyone has ported your script to windows?
Some additional info: I don't want to use a new resource in the existing smali code. What I want is a new resource, say @id/main, to be used in the xml files and in a java class, which describes the method that should be invoked when the widget updates.
What I've done now is that I've made a new R$main class with the resources I want to use. I also made the java class with the method and it refers to the resources mentioned in the R$main class. This way I can build it without problems in Netbeans. But when I want to use apktool, I keep getting the message:
Code:
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" java.lang.NullPointerException
at org.jf.util.PathUtil.getRelativeFile(Unknown Source)
at org.jf.smali.smaliFlexLexer.getSourceName(Unknown Source)
at org.jf.smali.smaliFlexLexer.getErrorHeader(Unknown Source)
at org.jf.smali.smaliFlexLexer.nextToken(Unknown Source)
at org.antlr.runtime.CommonTokenStream.fillBuffer(Unknown Source)
at org.antlr.runtime.CommonTokenStream.LT(Unknown Source)
at org.jf.smali.smaliParser.smali_file(Unknown Source)
at brut.androlib.mod.SmaliMod.assembleSmaliFile(Unknown Source)
at brut.androlib.src.DexFileBuilder.addSmaliFile(Unknown Source)
at brut.androlib.src.SmaliBuilder.buildFile(Unknown Source)
at brut.androlib.src.SmaliBuilder.build(Unknown Source)
at brut.androlib.src.SmaliBuilder.build(Unknown Source)
at brut.androlib.Androlib.buildSourcesSmali(Unknown Source)
at brut.androlib.Androlib.buildSources(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.apktool.Main.cmdBuild(Unknown Source)
at brut.apktool.Main.main(Unknown Source)
Maybe I'm completely on the wrong track...
Sometimes I get NullPointerException instead of real smali errors, when I'm doing "apktool b". I think it's a bug in the apktool. Try to smali "smali" dir normally, without apktool to see errors.
But I don't really see much sense in adding any Java classes, because they just can't work without additional steps. What my script does, is:
javac all files from brut.iface
javac all files from brut.src against compiled brut.iface
convert compiled brut.src to smali. This is done in two steps:
dx them to classes.dex
baksmali them using baksmali or apktool
Most of commands from my script (javac, dx, apktool/baksmali) should work on a Windows. File operations, i.e. mkdir, rm, cp should be easily portable. I don't know, how to replace "find" command.
You could try to use Cygwin - then you should be able to run my script on a Windows.
To do this properly, I'm installing Linux now, so my next reply could take a while...
I'm running stock android 4.4 on a Nexus 4. I'm trying to learn how the encryption works... Last night I had to reboot my phone and had forgotten my password. After something like 30 failed password attempts the phone was automatically factory reset without notifying me. Can't find anything about this in the source!
But, what I'm really looking for is a way to extract the footer. If I understand correctly it should be the last 16Kb of the undecrypted userdata-partition which should be /dev/block/mmcblk0p23.
I've tried to extract the last 16Kb in this way:
Code:
$ blockdev --getsz /dev/block/mmcblk0p23
27596800
$ adb shell dd if=/dev/block/mmcblk0p23 of=my_footer count=32 bs=512 skip=27596768
$ adb pull my_footer
The problem is no traces of the footer can be found anywhere in this file. Also, if I skip the "count=32"-part shouldn't it stop anyway after 16Kb? It just keeps on writing until I hit ctrl-c or the phone memory is full. The only way I managed to get part of the footer seems to be from the metadata-partition with:
Code:
adb shell dd if=/dev/block/mmcblk0p18 of=my_footer
adb pull my_footer
Problem is this won't give me any keys it seems? The "magic" and version and so on is correct but I get 0x000000(...) as Encryption key and Salt when running the python script from this site:
(google for "santoku how-to-brute-force-android-encryption" I can't post links)
So.. where are the keys?
Okay I gotta correct myself now. I finally found the footer! It was in metadata after all. Here are the correct commands for Nexus 4:
Boot into recovery or anywhere you have access to adb. With the phone booted normally I had to "adb remount" and pull the files to /system because / was read-only.
Code:
dd if=/dev/block/mmcblk0p18 of=my_footer bs=512 count=32
dd if=/dev/block/mmcblk0p23 of=my_header bs=512 count=1
then
Code:
adb pull my_footer
adb pull my_header
then I made a script based on the one referred to in the earlier post and it works!
edit: Here it is
Code:
#!/usr/bin/env python
# Based on a script from https://santoku-linux.com/howto/mobile-forensics/how-to-brute-force-android-encryption
#
# Decrypts the master key found in the footer using a supplied password
# Written for Nexus 4 running 4.4.2
#
# How to get header & footer:
# dd if=/dev/block/mmcblk0p18 of=my_footer bs=512 count=32
# dd if=/dev/block/mmcblk0p23 of=my_header bs=512 count=1
#
from os import path
import sys, itertools
import time
from struct import Struct
from M2Crypto import EVP
import hashlib
import scrypt
_PARAMS = Struct("!BBBB")
KEY_LEN_BYTES = 16
IV_LEN_BYTES = 16
def main(args):
if len(args) < 3:
print 'Usage: python bruteforce_stdcrypto.py [header file] [footer file]'
print ''
print '[] = Mandatory'
else:
footerFile = args[2]
headerFile = args[1]
assert path.isfile(footerFile), "Footer file '%s' not found." % footerFile
assert path.isfile(headerFile), "Header file '%s' not found." % headerFile
fileSize = path.getsize(footerFile)
assert (fileSize >= 16384), "Input file '%s' must be at least 16384 bytes" % footerFile
result = bruteforcePIN(headerFile, footerFile)
if result:
print 'Correct PIN!: ' + result
else:
print 'Wrong PIN. :('
def bruteforcePIN(headerFile, footerFile):
# retrive the key and salt from the footer file
cryptoKey,cryptoSalt = getCryptoData(footerFile)
# load the header data for testing the password
headerData = open(headerFile, 'rb').read(32)
passwdTry = raw_input('Enter password: ')
print 'Trying: ',passwdTry
# make the decryption key from the password
decKey = decryptDecodeKey(cryptoKey,cryptoSalt,passwdTry)
# try to decrypt the first 32 bytes of the header data (we don't need the iv)
decData = decryptData(decKey,"",headerData)
# has the test worked?
#print decData
if decData[16:32] == "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0":
return passwdTry
return None
def getCryptoData(filename):
data = open(filename, 'rb').read()
# structure taken from cryptfs.h in 4.4.2_r1 source.
s = Struct('<'+'L H H L L L L L L L 64s L 48s 16s Q Q L B B B B')
ftrMagic, majorVersion, minorVersion, ftrSize, flags, keySize, spare1, fsSize1, fsSize2, failedDecrypt, cryptoType, spare2, cryptoKey, cryptoSalt, persistoff0, persistoff1, persistsize, kdfType, N_factor, r_factor, p_factor = s.unpack(data[0:192])
cryptoKey = cryptoKey[0:0+keySize]
print 'Footer File :', filename;
print 'Magic :', "0x%0.8X" % ftrMagic
print 'Major Version :', majorVersion
print 'Minor Version :', minorVersion
print 'Footer Size :', ftrSize, "bytes"
print 'Flags :', "0x%0.8X" % flags
print 'Key Size :', keySize * 8, "bits"
print 'FS Size 1 :', fsSize1
print 'FS Size 2 :', fsSize2
print 'Failed Decrypts:', failedDecrypt
print 'Crypto Type :', cryptoType.rstrip("\0")
print 'Encrypted Key :', "0x" + cryptoKey.encode("hex").upper()
print 'Salt :', "0x" + cryptoSalt.encode("hex").upper()
print 'KDF type :', kdfType
print 'N-factor :', N_factor
print 'r-factor :', r_factor
print 'p-factor :', p_factor
print '----------------'
return cryptoKey,cryptoSalt
def decryptDecodeKey(cryptoKey,cryptoSalt,password):
# make the key from the password
ikey = scrypt.hash(password,cryptoSalt,1<<15,1<<3,1<<1, 32)
key = ikey[:KEY_LEN_BYTES]
iv = ikey[KEY_LEN_BYTES:]
# do the decrypt
cipher = EVP.Cipher(alg='aes_128_cbc', key=key, iv=iv, op=0) # 0 is DEC
cipher.set_padding(padding=0)
decKey = cipher.update(cryptoKey)
decKey = decKey + cipher.final()
return decKey
def decryptData(decKey,essiv,data):
# try to decrypt the actual data
cipher = EVP.Cipher(alg='aes_128_cbc', key=decKey, iv=essiv, op=0) # 0 is DEC
cipher.set_padding(padding=0)
decData = cipher.update(data)
decData = decData + cipher.final()
return decData
if __name__ == "__main__":
main(sys.argv)
. Is it giving exact last 16k byte
Hi Guys,
Code:
dd if=/dev/block/mmcblk0p18 of=my_footer bs=512 count=32
I tried with above code to get footer. But I didn't find any footer information there . Is it giving exact last 16k byte?
I used my userdata partition for footer .
help pls - where i can get header? From bin image. Footer you can search in bin image by words aes-cbc-essiv:sha256 and after dd bs=1 skip=$((your found bytes-36)) count=16384 if=footer
I used this code:
Code:
mWebViewVertreungsplan = (WebView)findViewById(R.id.webViewVertretung);
mWebViewVertreungsplan.setVisibility(View.VISIBLE);
mWebViewVertreungsplan.setWebViewClient(new WebViewClient());
// Enable Javascript
WebSettings webSettings = mWebViewVertreungsplan.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebViewVertreungsplan.loadUrl("Username: Pasword @ domain. com");
On the on some devices it works, but on others it wont work. I geht the error 401 unauthorized.
Funny enough i am working on a project that has to do with a "substitution plan" as well (dunno what the correct english translation is) xD
You have to put the credentials inside the url header, and they have to be Base64 encoded
I use jsoup library to read the values from a pw protected site, so putting things into header is done differently, but same principle:
[...]Jsoup.connect("domain.com").header("Authorization", "Basic " + encodedString).post()
encodedString is done like that:
String text ="unamewd";
byte[] data = null;
data = text.getBytes("UTF-8");
encodedString = Base64.encode(data, Base64.DEFAULT);
So only thing you would have to google is how to set url header for webview