[ALL DEVICES] Private DNS broken with Let's Encrypt even on new devices - General Topics

So today's been a big day, Let's Encrypt original CA expired at around 15:15 UK which is precisely when private DNS on my phone decided it wasn't going to play anymore.
DST Root CA X3 Expiration (September 2021) - Let's Encrypt
Update September 30, 2021 As planned, the DST Root CA X3 cross-sign has expired, and we’re now using our own ISRG Root X1 for trust on almost all devices. For more details about the plan, keep reading! We have also updated our Production Chain Changes thread on our community forum - our team and...
letsencrypt.org
The interesting thing is that Android trusts the new Let's Encrypt CA. Sure enough, browsing to the private DNS server in a web browser works fine. DavDroid/etc also work fine (same certificate used on that endpoint).
It appears that private DNS uses its very own CA certificate trust and this IS affected by the Let's Encrypt change.
So if your private DNS server stopped working with Android at around 15:15 today then check the server is using a Let's Encrypt certificate. This will be your problem.
Anyone know where I should file this bug with AOSP please do let me know. I have searched long and hard and really want this fixed!

I'm having the same issue, my tls dns server stopped to work on android, any solution?

Same problem with stock device Android 9. And /e/ ROM Android 10 on Gigaset GS290...

Oh dear, I spent the whole day debugging my DoT adguard instance today. Following while hoping there's a solution to this

guitphreak said:
Oh dear, I spent the whole day debugging my DoT adguard instance today. Following while hoping there's a solution to this
Click to expand...
Click to collapse
Also wasted the whole last day. So sad. This was a really great feature.

Same issue, right after launching the service. Tricky timing!
I'm wondering how to solve this in a different manner than having to replace the cert with non-letsencrypt

I'm already missing this feature very much. Can we try to install/configure our Android devices to trust ' ISRG Root X1 ' ?
edit: I just downloaded and trusted x1 on my android (https://letsencrypt.org/certificates/), no succes
topic on letsencrypt.org: https://community.letsencrypt.org/t/r3-intermediate-certificate-has-expired/160797/108

I'll have a look at alternative certificates for that VM. Google comes up with ZeroSSL. Seams like it'll be tonight's project

Problem solved for me.
I am using the acme.sh client (3.0.0) and regenerated (delete and recreate) my certificates with this settings :
--server letsencrypt --preferred-chain "ISRG Root X1"
More information here : https://github.com/acmesh-official/acme.sh/issues/3723#issuecomment-932143360
And here: https://github.com/acmesh-official/acme.sh/wiki/Preferred-Chain
PS: with certbot client:
certbot renew --preferred-chain "ISRG Root X1" --force-renewal

I have exactly the same problem. I have rented several vServers on which I have installed Pi-Hole and since yesterday ~8:00 (UTC) DNS over TLS no longer works. Have used nginx as proxy. My SSL certificates are all up to date and valid. With the tool Stubby (tested on Windows) I can connect and send DNS queries, but Android does not want.
Unfortunately, this does not seem to work. The parameter
Code:
--preferred-chain="ISRG Root X1"
does not work for certbot.
Code:
certbot: error: unrecognized arguments: --preferred-chain ISRG Root X1
But if I add the parameter
Code:
preferred_chain = ISRG Root X1
in
Code:
/etc/letsencrypt/renewal/domain.conf
, the certificate will be issued via ISRG Root X1.
After creating, the entry disappeared from the configuration.
However, Android 10 and 11 still can't connect.
Firefox says that everything is fine with the certificate.

Hoerli said:
I have exactly the same problem. I have rented several vServers on which I have installed Pi-Hole and since yesterday ~8:00 (UTC) DNS over TLS no longer works. Have used nginx as proxy. My SSL certificates are all up to date and valid. With the tool Stubby (tested on Windows) I can connect and send DNS queries, but Android does not want.
Unfortunately, this does not seem to work. The parameter
Code:
--preferred-chain="ISRG Root X1"
does not work for certbot.
Code:
certbot: error: unrecognized arguments: --preferred-chain ISRG Root X1
But if I add the parameter
Code:
preferred_chain = ISRG Root X1
in
Code:
/etc/letsencrypt/renewal/domain.conf
, the certificate will be issued via ISRG Root X1.
After creating, the entry disappeared from the configuration.
However, Android 10 and 11 still can't connect.
Firefox says that everything is fine with the certificate.
Click to expand...
Click to collapse
Which version of certbot client ?
Require 1.6.0 and more.
Better if 1.12.0 and more.
Latest is 1.19.0 now.
Check Certificate chain with: openssl s_client -connect yourdomain.tld:853
For me:
---
Certificate chain
0 s:CN = mydomain.tld
i:C = US, O = Let's Encrypt, CN = R3
1 s:C = US, O = Let's Encrypt, CN = R3
i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
---

Tetsumaki said:
Which version of certbot client ?
Require 1.6.0 and more.
Better if 1.12.0 and more.
Latest is 1.19.0 now.
Check Certificate chain with: openssl s_client -connect yourdomain.tld:853
For me:
---
Certificate chain
0 s:CN = mydomain.tld
i:C = US, O = Let's Encrypt, CN = R3
1 s:C = US, O = Let's Encrypt, CN = R3
i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
---
Click to expand...
Click to collapse
Oh now it seems to work ....
I have only ever used the official package source version.
For Debian 10:
Code:
[email protected]:~# apt-cache policy certbot | grep -i Installed
Installed: 0.31.0-1+deb10u1
I have now installed the latest version via snap (which I never use).
Code:
name: certbot
summary: Automatically configure HTTPS using Let's Encrypt
publisher: Certbot Project (certbot-eff✓)
store-url: https://snapcraft.io/certbot
contact: https://github.com/certbot/certbot/issues
license: unset
description: |
The objective of Certbot, Let's Encrypt, and the ACME (Automated
Certificate Management Environment) protocol is to make it possible
to set up an HTTPS server and have it automatically obtain a
browser-trusted certificate, without any human intervention. This is
accomplished by running a certificate management agent on the web
server.
This agent is used to:
- Automatically prove to the Let's Encrypt CA that you control the website
- Obtain a browser-trusted certificate and set it up on your web server
- Keep track of when your certificate is going to expire, and renew it
- Help you revoke the certificate if that ever becomes necessary.
commands:
- certbot
services:
certbot.renew: oneshot, enabled, inactive
snap-id: wy7i66qPx4neXr6m9rTh7Y40h8EhtZFh
tracking: latest/stable
refresh-date: today at 20:31 CEST
channels:
latest/stable: 1.19.0 2021-09-07 (1434) 44MB classic
latest/candidate: ↑
latest/beta: 1.19.0 2021-09-07 (1434) 44MB classic
latest/edge: 1.20.0.dev0 2021-10-01 (1498) 44MB classic
installed: 1.19.0 (1434) 44MB classic
The result with the certbot from the package sources:
Code:
Certificate chain
0 s:CN = mydomain.tld
i:C = US, O = Let's Encrypt, CN = R3
1 s:C = US, O = Let's Encrypt, CN = R3
i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
i:O = Digital Signature Trust Co., CN = DST Root CA X3
With snap-version:
Code:
Certificate chain
0 s:CN = mydomain.tld
i:C = US, O = Let's Encrypt, CN = R3
1 s:C = US, O = Let's Encrypt, CN = R3
i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
i:O = Digital Signature Trust Co., CN = DST Root CA X3
Ok, now I ran the command with --preferred-chain="ISRG Root X1" again for all certificates already issued.
Now it works after all
... and .... it works!
The old version of Certbot, has here in 2. place still made entries, which are now gone!
Code:
Certificate chain
0 s:CN = mydomain.tld
i:C = US, O = Let's Encrypt, CN = R3
1 s:C = US, O = Let's Encrypt, CN = R3
i:C = US, O = Internet Security Research Group, CN = ISRG Root X1

Thanks! it worked... the only think is that i had to remvoe certbot from apt on my 18.04 and add the one from snap
My pihole is up and running again

Related

HardSPL CDMA Whitelist Code

Guys,
A buddy of mine modified Fenny's code from IMEI Whitelist GSM Hardspl to work with CDMA. I just need someone to compile code and test.
Code:
Random random = new Random();
string imei = textBox1.Text;
string mid = (random.Next().ToString("X8") + random.Next().ToString("X8")).ToLower();
string hid = random.Next().ToString("X8").ToLower();
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
System.Security.Cryptography.SHA256 hasher = System.Security.Cryptography.SHA256.Create();
string hex = BitConverter.ToString(hasher.ComputeHash(encoding.GetBytes(((mid + hid + imei + "6BRSDB*(LNsa;JN5)"))))).Replace("-", "").ToLower(); ;
string request = ("mid=" + mid + "&hid=" + hid + "&imei=" + imei + "&auth=" + hex + "&v=" + 110);
System.Net.ServicePointManager.Expect100Continue = false;
System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("http://www.htc-unlocks.com/rhodiumw.php");
webRequest.Headers.Clear();
webRequest.KeepAlive = true;
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.UserAgent = "WinHTTP Example/1.0";
System.IO.Stream webResponse = webRequest.GetRequestStream();
System.IO.StreamWriter webResponseSender = new System.IO.StreamWriter(webResponse);
webResponseSender.Write(request);
webResponseSender.Close();
System.Net.HttpWebResponse didI = (System.Net.HttpWebResponse)webRequest.GetResponse();
System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(didI.GetResponseStream());
byte[] buffered = binaryReader.ReadBytes(512);
if (encoding.GetString(buffered) == "reject")
label2.Text = "Failed";
else
{
System.IO.File.WriteAllBytes(imei+".txt", buffered);
label2.Text = "Success";
}
OK, I have the code compiled.
run the exe file.
enter your IMEI number (do not include last 01)
you shoud get success and it will create a <IMEI_NUMBER>.txt file
rename <IMEI_NUMBER>.txt to chk.txt and copy to windows folders on your phone
now run hardSPL and enjoy.
note if you get a failed message you either enter the last 01, or enter incorrect IMEI or your phone is already blacklisted and it's to late.
My phone is blacklisted so I can not fully test. please post results.
I also want to thank Fenny for his hard work with his GSM version of the whitelister.
With out his code my buddy would have never been able to rewrite to work for CDMA TP2
hopefully you don't mind, i posted this @ geeks....test should come back soon, i linked this thread .
mr8820 said:
hopefully you don't mind, i posted this @ geeks....test should come back soon, i linked this thread .
Click to expand...
Click to collapse
no not at all post in all related sites are fine.

Samsung RIL reversing

Hi,
A while ago I've started to reverse engineer the (userland) baseband interface of my Samsung phone (GT-I8320 aka. H1) in an effort to see how far I can get Android running on the device (it ships with an OS based on LiMo and associated RIL).
Some Googling and inspection of other phones' RILs suggests that possibly quite some other Samsung smartphones use a similar baseband interface (Qualcomm MSM over dpram).
Searching XDA yield quite a few threads of Android upgrades blocked by a proprietary RIL. I couldn't find any traces of attempts to reverse a Samsung RIL though.
So, what I currently have is a really[/n] basic RIL implementation supporting baseband messages related to network registration (power up, imei/network info, signal info) and even outgoing calls (but that's all related to call management).
To anyone still reading this:
- Please direct me to any related effort (couldn't find any, as mentioned before).
- Direct anyone considering reversing a Samsung RIL here.
Finally, a set of goodies of unknown use:
- Known to work with my MSM6290 via a dpram interface.
- No idea how much free time I have to continue my effort.
- Might, or might not be of (limited) use for other Samsung phones.
Code: github.com/ius/samsung_h1_libmsm
You might want to check out this thread:
http : //forum.samdroid.net/f56/ril-development-froyo-3156/
Remove the space, cannot post links yet
This is for the Samsung Galaxy Spica, but may be a bit of help
hi!
I also tried to find out how samsung ril over dpram0 works...
@iuss
first of all .. amazing work.. thx
where did you get the information??? do you have any docs??
It's all based on reverse engineering of the LiMo telephony library (which is luckily pretty verbose) and it's associated logs.
I've found most similarities with Samsung RILs labeled as 'libsecril'. Those appear to use a similar interface.
I'm currently struggling to get the audio routing from the modem fixed on my board (in order to be able to test call functionality as I add it) before continuing to work on this.
I've found most similarities with Samsung RILs labeled as 'libsecril'. Those appear to use a similar interface.
Click to expand...
Click to collapse
Yes you are right, libsec-ril.so from galaxy spica uses exactly the same interface!
I opened it up in ida-pro and checked it!
@iuss:
are you good at reading asm??
[email protected] said:
@iuss:
are you good at reading asm??
Click to expand...
Click to collapse
I guess so. Anything specific you need help with?
I am testing now with your source and i can open dpram0 and power_on!
Further i can send commands, but i do not get an answer???
can you post an example .. (unlocking sim,..)
thx
It's not implemented (as is 99% of the rest). Should be trivial to implement though, I think it's the MSM_SEC_ISIM_AUTH message. Will certainly do so after the weekend, if I get my sound to work. - which is still not working. Could you try patching test.c using the following diff (after disabling the pin code if neccessary, and change the number). It should call the number - if it works for you, I'm probably missing a GPIO somewhere.
Code:
diff --git a/test.c b/test.c
index 28fae0e..a449342 100644
--- a/test.c
+++ b/test.c
@@ -18,10 +18,26 @@
*
*/
+#include <unistd.h>
#include <radio.h>
+static int flag = 0;
+
+static void do_stuff()
+{
+ msm_call_outgoing(0, "0123456798");
+}
+
static void on_receive(struct msm_request_info *info)
{
+ switch(info->type) {
+ case MSM_NET_REGIST:
+ if(!flag) {
+ flag = 1;
+ do_stuff();
+ }
+ break;
+ }
}
static struct msm_info msm = {
thx for the code!
I disabled the pin code and tried your changes!
the only message i get is
Code:
MSM_DISP_ICON_INFO NOTI (15/5) seq=179 req=0
i think the mobile is not connecting to network!
Hi,
You're testing this on a GT-I5700 (Spica) right?
Checked the dpram driver source, the ioctls are different. Hence the phone is not properly reset (by msm_power_on(), which turns the modem off first if needed). That's why you're only getting a status message regularly sent by the baseband (contains rssi and such).
Try this. Spica seems to have a few different ioctls too, but I've just dropped those as I'm not using them anyway.
- Edit: Wrong ioctls, see next 2 posts -
from where did you have the ioctls??
i checked libsec-ril.so
Code:
EXPORT onedram_phone_pow_on
onedram_phone_pow_on
PUSH {R4,LR}
LDR R4, =(_GLOBAL_OFFSET_TABLE_ - 0x33CC8)
LDR R0, =(fd_onedram_ptr - 0x45164)
LDR R1, =0x6FD0 ; request
ADD R4, PC
LDR R3, [R4,R0]
MOVS R2, #0
LDR R0, [R3] ; fd
BLX ioctl
CMP R0, #0
BGE loc_33CEE
My reference is the dpram driver shipped with GT-I5700_OpenSource.zip.
But I see that you're right, in true Samsung-style there are multiple defines for the ioctls. The ones in my patch are unused.
DPRAM_PHONE_POWON is indeed 0x6FD0. Try setting that as power_on ioctl.
DPRAM_PHONE_ON is 0xF0C0 - which seems to be called to init the OneDRAM memory, and appears to depend on POWON. If it doesn't work after the POWON ioctl, send this one as well (or even better, strace your original RIL to see the ioctls required).
There's one more ioctl (0x6FD3) related to booting, but I *think* it's only used when a modem image is uploaded. Refer to dpram.h/dpram.c for more info..
hi!
hmm it doesn't work!
Can you tell me how the image upload (over serial) works and if i need to do it??
Further how do you strace rild??
rild is startet from init and the sockets are created on startup!
if i stop rild it restarts and i can not strace it!
so i go to bed... good night
I don't know about the image upload. Either the bootloader handles it (didn't check in detail) or it's handled by the baseband itself. For my phone I can simply send the power_on ioctl and off it goes - probably it's just the same for Spica.
As for stracing, you might be able to modify init.rc so rild is started straced.
What might be easier though is simply reversing it. Seeing you already have the RIL lib in IDA, just find all xrefs to ioctl and you should be able to figure all needed.
hi,
I tried a lot, but i did not get it to work!
I changed the power_IOCTL to 0x6FD0!
It return 0 = OK
but the phone do not start!
The orignial lib loads a phone-image and a nv_data.bin and then it uses 0x6FD3 to start the phone.
But my assembly knowlegde not so good.
Can you have a look if you have time????
i attach libsec-ril.so. open it with ida and go to function RIL_Init!
the magic happens in dload_test
thx in advance
Had a quick look. You're right, Spica appears to load the phone fw/nvs from Android.
Quick writeup (in order):
- onedram_open(): Open /dev/dpram0
- dload_read_dbl(): Read /dev/bml9, 0x5000 bytes
- onedram_phone_pow_on(): ioctl 0x6fd0 (DPRAM_PHONE_POWON)
- dload_uart_init(): open /dev/s3c_serial0, 115200
- dload_hdlc_init(): init some data related to hdlc parsing
- dload_packet_init(): init some packet struct
- nop_req()
- onedram_phone_image_load(): ioctl 0x6fd1 (DPRAM_PHONEIMG_LOAD)
- onedram_nv_data_load(): load /efv/nv_data.bin 0x80000 bytes, ioctl(fd, 0x6FD2 (DPRAM_NVDATA_LOAD), buf_with_nvdata)
- onedram_phone_boot_start(): ioctl 0x6fd3 DPRAM_PHONE_BOOTSTART
onedram_nv_data_load() reads the nvdata and passes it as a param along with the ioctl, the nop_req is sent over the uart.
The baseband firmware itself seems to be read by libsecril, but not used (?) - the kernel driver contains code to read bml too when DPRAM_PHONEIMG_LOAD is issued.
I haven't traced into nop_req - no time to reverse it right now. You can import these functions from libsec-ril.so for testing (all are exported) and later replace them with your own implementation. (You can then easily strace your binary to recover the nop_req data).
I'm looking for RIL logs of Samsung phones in order to speed up development.
'logcat -b radio' might provide some, but given a specific phone model I could look up alternative log locations (i5500 for instance appears to dump RIL traffic to /data/log/).
Anyone able to help?
Nexus S
Hi,
out of curiosity I opened the 'libsec-ril.so' from the Nexus S in IDA.
although 'ioctl' is imported, I cannot really find calls to it.
Since i'm unfamiliar with Arm opcodes, I probably overlook something.
Does this code make sense to anyone ?
EDIT: Quite a lot of functions seem to call 'IPC_send_singleIPC', so I suppose
I might be looking at the wrong file...
EDIT2: Ahh, 'IPC_send_singleIPC' can print an IOCTL error message, just haven't found the actual call to ioctl() yet..
Code:
.text:00016BC4 EXPORT requestDTMFStop
.text:00016BC4 requestDTMFStop
.text:00016BC4 LDR R3, =(dword_62428 - 0x16BD0)
.text:00016BC6 PUSH {R4-R6,LR}
.text:00016BC8 MOV R4, R2
.text:00016BCA LDR R2, =0xFFFFFDC4
.text:00016BCC ADD R3, PC
.text:00016BCE MOV R6, R0
.text:00016BD0 MOV R5, R1
.text:00016BD2 LDR R0, [R3,R2]
.text:00016BD4 LDRB R3, [R0]
.text:00016BD6 CBZ R3, loc_16BEC
.text:00016BD8 LDR R3, =(aOndialtimeout - 0x16BE4)
.text:00016BDA MOVS R0, #6
.text:00016BDC LDR R1, =(aRil - 0x16BE6)
.text:00016BDE LDR R2, =(aS - 0x16BEA)
.text:00016BE0 ADD R3, PC ; "onDialTimeout"
.text:00016BE2 ADD R1, PC ; "RIL"
.text:00016BE4 ADDS R3, #0x6C
.text:00016BE6 ADD R2, PC ; "%s()"
.text:00016BE8 BLX sub_10D2C ; NOTE: this seems to be a printf() function
.text:00016BEC
.text:00016BEC loc_16BEC ; CODE XREF: .text:00016BD6j
.text:00016BEC MOV R0, R6
.text:00016BEE MOV R1, R5
.text:00016BF0 MOV R2, R4
.text:00016BF2 MOVS R3, #2
.text:00016BF4 BL sub_16B28
.text:00016BF8 POP {R4-R6,PC}
.text:00016BFA ; ---------------------------------------------------------------------------
.text:00016BFA NOP
.text:00016BFA ; ---------------------------------------------------------------------------
.text:00016BFC off_16BFC DCD dword_62428 - 0x16BD0 ; DATA XREF: .text:requestDTMFStopr
.text:00016C00 dword_16C00 DCD 0xFFFFFDC4 ; DATA XREF: .text:00016BCAr
.text:00016C04 off_16C04 DCD aOndialtimeout - 0x16BE4 ; DATA XREF: .text:00016BD8r
.text:00016C04 ; "onDialTimeout"
.text:00016C08 off_16C08 DCD aRil - 0x16BE6 ; DATA XREF: .text:00016BDCr
.text:00016C08 ; "RIL"
.text:00016C0C off_16C0C DCD aS - 0x16BEA ; DATA XREF: .text:00016BDEr
.text:00016C0C ; "%s()"
.text:00016C10 ; ---------------------------------------------------------------------------
Tuigje said:
out of curiosity I opened the 'libsec-ril.so' from the Nexus S in IDA.
although 'ioctl' is imported, I cannot really find calls to it.
Click to expand...
Click to collapse
Did you try to find xrefs to it?
Since i'm unfamiliar with Arm opcodes, I probably overlook something.
Does this code make sense to anyone ?
Click to expand...
Click to collapse
It does, but it's just an excerpt from a RIL request handler (requestDTMFStop).
EDIT: Quite a lot of functions seem to call 'IPC_send_singleIPC', so I suppose
I might be looking at the wrong file...
Click to expand...
Click to collapse
Wrong file? What are you looking for exactly? The send_single_IPC function is used to send a message to the baseband, thus it's called quite often.
Nexus S has a slightly different kernel driver for dpram, probably Google kindly requested Samsung to clean their crap up. Instead of a chardev + read/write they use ioctls to perform read/write. That would explain the ioctl references you're seeing in IPC_send_singleIPC.
iuss said:
Did you try to find xrefs to it?
Click to expand...
Click to collapse
Nope. I must have done something wrong loading the libsec-ril.so into IDA. all
imports are shown at the end of the file as:
Code:
extern:0009E54C ; int ioctl(int fd, unsigned __int32 request, ...)
extern:0009E54C IMPORT ioctl
It does, but it's just an excerpt from a RIL request handler (requestDTMFStop).
Wrong file? What are you looking for exactly? The send_single_IPC function is used to send a message to the baseband, thus it's called quite often.
Click to expand...
Click to collapse
Ok. I was wondering whether it is possible to get e.g. 'timing advance' data from the gsm-modem. So I started by digging through the android sources. Now I'm at libsec-ril.so. (and libril.so, but I can't make much sense out of that one yet).
Is it correct that libril.so and the kernel-mode gsm driver are also closed-source for the Nexus S ?
Edit: libril looks awfully similar to the android sources (device/libs/telephony/ril.cpp)
Do you know the name of the kernel driver (module filename), or is it directly compiled into the kernel ?
I haven't stumbled onto it yet, neither in the system.img nor in the ramdisk of the boot.img.
Nexus S has a slightly different kernel driver for dpram, probably Google kindly requested Samsung to clean their crap up. Instead of a chardev + read/write they use ioctls to perform read/write. That would explain the ioctl references you're seeing in IPC_send_singleIPC.
Click to expand...
Click to collapse
Is there any other place to get such information, or is it all hard work figuring this out by yourself ?

[Q] There is error with batteryStats.computeBatteryRealtime on Androi

There is error when we obtain time with batteryStats.computeBatteryRealtime on Android platform.
In our code, we want to get the time with the method batteryStats.computeBatteryRealtime , shown as following:
import android.os.BatteryStats;
void update() {
int statsType = BatteryStats.STATS_SINCE_CHARGED;
...
long realTime = SystemClock.elapsedRealtime();
long uSecTime = batteryStats.computeBatteryRealtime(realTime * 1000, statsType);
...
}
the update method will be invoked every 20 seconds, but, the uSecTime never changed while realTime changing, Why, who can help me ?
thank you very much!
our platform:
--------------------------------------------------------------------
1) Android 2.3
2) Juno Service Release 2
3) Windows 8 64 bit
batteryStats.getBatteryRealtime(realTime) has the same problem
the method batteryStats.getBatteryRealtime(realTime) has the same problem, why?

[DEV] AndroidCtrl.dll [7.1.46.0] (ADB/Fastboot/(apk/zip) Signer - Framework)

This (C# .NET 4.6|4.7|4.8) dll is a kind of ADB/Fastboot/(apk/zip) Signer - Framework, it provides a lot of predefined .NET functions to communicate with an Android device. It's designed to work in 1st case with any non-root device but you can also use it with any rooted device (A few functions requires root access).
License
This project is licensed under the Apache License Version 2.0.
The latest build 7.1.46.0 is currently only via FTP, GoogleDrive or Dropbox available, the DevDB has currently some upload issues!
The following (N)amespaces, (C)lasses & (I)nterfaces are currently available:
(N) ADB
(N) Binary (This is the binary/exe implementation of ADB)
(C) ADB (static Management Class for the ADBClient's)
(C) ADBClient (Implementation of IADBClient)
(C) Channel (Implementation of IChannel)
(N) Device
(N) BusyBox
(C) BusyBox
(C) Find
(C) Tar
(N) Dumpsys
(C) Battery
(C) Dumpsys
(I) IBattery
(N) Input
(I) IKeyEvent
(C) Input
(C) InputExtensions
(C) KeyEvent (Implementation of IKeyEvent)
(N) IO
(NS) Compression
(NS) BrotliSharp (Only available in .NET 4.6|4.7|4.8 - In .NET Standard >= 2.1 you have to use the native .NET implementation)
(C) ADirectoryInfo (Similar to .NET Directory/-Info)
(C) AFileInfo (Similar to .NET File/-Info)
(C) AFileStream (Similar to .NET FileStream)
(C) AFileSystemInfo (Similar to .NET FileSystemInfo, it's the abstract base for ADirectoryInfo & AFileInfo)
(C) AMountPointInfo (Similar to ADirectoryInfo & AFileInfo but only for mounts)
(C) FileSystemCache (A cache object for ADirectoryInfo & AFileInfo)
(I) IFileSystemCache (Interface for FileSystemCache)
(C) IO
(I) ITransferMessage
(C) MediaScanner (Manage the Android MediaScanner, useful after some file-transfers via ADB)
(C) Mount (Requires Root and manage the mounts)
(C) Stat (stat class for the ADB-Protocol)
(C) SyncStream (Base implementation of the ADB sync service. Utilized by AFileStream)
(C) TransferMessage
(C) UPath (Similar to .Net Path but for unix paths)
(N) Logcat
(I) ILogEntry
(C) Logcat
(C) LogEntry
(N) Manager
(C) ActivityManager
(I) IInstrumentation
(C) Instrumentation
(I) IPackage
(I) IPermission
(C) Manager
(C) Package
(C) PackageManager
(C) Permission
(N) Provider
(C) Contacts (Contacts provider)
(C) ContactsDataField
(C) ContactsEmail
(C) ContactsEvent
(C) ContactsGroup
(C) ContactsIdentity
(C) ContactsIM
(C) ContactsName
(C) ContactsNickname
(C) ContactsNote
(C) ContactsOrganization
(C) ContactsPhone
(C) ContactsPhoto
(C) ContactsPostalAddress
(C) ContactsRelation
(C) ContactsSipAddress
(C) ContactsWebsite
(I) IContactsDataField
(C) Provider
(C) Telephony (Telephony provider)
(N) Screen
(C) Framebuffer (Implementation of IFramebuffer)
(C) FramebufferInfo
(I) IFramebuffer (Interface of an RAW framebuffer)
(I) IFramebufferInfo
(I) IScreenDimension
(I) IScreenFocus
(C) Screen
(C) ScreenDimension
(C) ScreenFocus
(N) Shell
(I) IShell (Interface of an shell with in-/output abilities)
(C) Shell (Implementation of IShell)
(N) SQLite
(C) Options
(C) QueryTools
(C) SQLite3 (SQLite3 database connector)
(C) BuildProperties
(C) Daemon (Manage the daemon on the device)
(C) Device
(C) Forensics (ALFA-State)
(I) IUptime
(C) OpenRecoveryScript (Manage the OpenRecoveryScript)
(C) Phone (Start a call, dial a number, add a contact or send a sms)
(C) Su
(C) Uptime
(C) Wipe
(N) Shares
(C) Monitor (Implementation of IMonitor)
(N) Socket (This is the IP based implementation of ADB - Here is NO binary/exe required)
(C) ADB (static Management Class for the ADBClient's)
(C) ADBClient (Implementation of IADBClient)
(C) ADBSocket (IP based connector - Mimics the ADB-Server)
(C) Channel (Implementation of IChannel)
(C) ADBridge (Unified access to Binary.ADB and Socket.ADB)
(I) IADBClient (Interface for nearly all ADB commands)
(I) IChannel (Interface of an RAW data channel)
(N) Fastboot
(C) Backdoor (Some backdoor commands)
(C) Fastboot (static Management Class for the FastbootClient's)
(C) FastbootClient (Includes nearly all fastboot.exe commands)
(I) IFastbootClient (Interface for FastbootClient)
(C) Monitor (Implementation of IMonitor)
(C) OEM (Some OEM commands)
(C) Wipe
(N) ProcessModels
(C) General (Includes some predefined process models)
(I) IRealTimeBG (Interface of an background process with in-/output abilities)
(C) RealTimeBGExeV2 (Implementation of IRealTimeBG)
(N) Signer
(C) Signer (signapk.jar Interface)
(N) Tools
(C) CRC
(C) Deploy (Deploy the AAPT/ADB/Fastboot/Signer files needed by this dll)
(C) Hash
(C) Hex
(C) IMEI (Some helper to verify and rebuild a valid IMEI)
(C) ToolBox
(C) Cleanup (Delete the files/folders which were created by this dll)
(C) Config
(C) DeviceInfo (Basic device info, the return from "(Binary/Socket).ADB.Devices()" and "Fastboot.Devices()")
(I) IDeviceInfo (Interface for DeviceInfo)
(I) IMonitor (Interface for the ADB.Binary, ADB.Socket and Fastboot.Fastboot monitor)
Special
Ready-To-Go MVVM's for WPF, XAML via my AndroidCtrlUI.dll
Multi-Device compatible, you can manage unlimited devices at the same time with this dll. Each device gets it's own instance. (Thread-Safe, the dll use lock() for critical sections)
UTF8-File/Folder Transfer you can transfer files/folders with containing special chars (ü, ö, ä, €, @, à, è, etc.)
On-the-fly Device to Device copy (Binary <-> Binary | Binary <-> Socket | Socket <-> Socket)
Device-Monitor, if activated, it will check every 10 sec. ADB & Fastboot for new connected devices and call an defined callback, if something changed. So your program get's an info if an device is connected or removed.
All Android key-events as (int)enum and the ability to send them as single or stack.
Hint
You can use all ADB methods/commands via USB or W-Lan/Lan, if your Rom supports ADB via W-Lan/Lan (Settings/Developer Settings)
If you want to use all sub-classes of IADBClient with BusyBox instead of the Shell, you have to set IADBClient.UseBusyBox to true. This will tell the instance to use the BusyBox commands inside each method, if the device has BusyBox installed.
Referenced .NET assembly's
System
System.Numerics
System.XML
Used Code-analysis rules:
Basic & Advanced Microsoft-Rules for Accuracy
Microsoft-managed minimum & recommended rules
Microsoft Security Rules
About the usage, the namespaces (ADB, Fastboot, Signer) have one basic instance. For example, ADB.Instance(), Fastboot.Instance(), Signer.Instance. As you can see ADB.Instance() and Fastboot.Instance() can have a parameter. This parameter is in both cases an (string) DeviceID, an IDeviceInfo or null, if you use for example null, both classes will return it's Selected client. If you use the DeviceID or the IDeviceInfo the return is a fresh instance of the client or the already created instance. So, in any case, before you call ADB/Fastboot.Instance(). Check with ADB/Fastboot.Devices() if you have a connected device. If so, use the IDeviceInfo object to start your device instance or simply pass the serial to the Instance(). All instances which you have created on this way, will be hold inside an Dictionary<string, ADBClient>, so you can configure each device instance to it's needs and call it when ever you need it. This is also the point where i say it's multi-device and multi-thread safe. Because, if you always use ADB/Fastboot.Instance() you can't reach the wrong device. Also, all classes using lock() for critical sections, because [MethodImpl(MethodImplOptions.Synchronized)] is not longer available under .NET Standard.
If you have any wishes like new features, how-to's or something else, let me know! :cyclops:
Tested OS
Win Vista | 7 | 8 | 8.1 | 10 (32Bit/64Bit in VM-Ware)
Win 7 | 8 | 8.1 | 10 (64Bit Native)
Win XP is not longer supported by ADB! (But, if you have a old ADB binary, the dll will do it's job)
Tested Devices
Android Emulator some Versions (min. 2.x) in AVD
Android x86
HTC Sensation -/ XE (non-/rooted)
HTC One M9 (non-/rooted)
Huawei P9 Lite (VNS-L21,22,23,31,etc.) (non-/rooted)
Huawei P10 Lite (WAS-LX1A,etc.) (non-/rooted)
Samsung Galaxy 2-5 (non-/rooted)
Samsung Galaxy S Plus (non-rooted)
A few Samsung Tabs (non-/rooted)
Google Pixel 4 (Android 11) (non-/rooted)
Requirements
Android: min. 2.x
Platform: x86/x64 (Windows)
Frameworks: min. .NET 4.6 and JRE (only for the Signer)
(Installed ADB/Fastboot device driver)
Download
Mirror: XDA-DevDB (since 29.01.2019 no uploads possible)
Mirror #1: My FTP (Build archiv)
Mirror #2: GoogleDrive
Mirror #3: Dropbox
Each zip-archiv contains the AndroidCtrl.dll, its markup file AndroidCtrl.xml and the program debug database AndroidCtrl.pdb for .NET 4.6|4.7|4.8 and .NET Standard 2.1 (beta)
Examples (Updated to dll version 7.1.46.0) (Updated in the next 24 h)
Mirror: My FTP
Mirror #1: GoogleDrive
Mirror #2: Dropbox
(Contains a simple exe and its source written in C# WPF)
Source
N/A (If you want to have a look at it, send me a PM or simply decompile it.)
DO NOT MIRROR MY FILES! DO NOT COPY MY THREADS!
XDA:DevDB Information
AndroidCtrl.dll, Tool/Utility for the Android General
Contributors
k1ll3r8e, squabbi, Krystanos
Version Information
Status: Stable
Current Stable Version: 7.1.46.0
Stable Release Date: 2020-09-19
Created 2016-07-24
Last Updated 2020-09-19
How - To
0. Complete How-To
1. Getting Started (General)
2. Config & Deploy
3. Individual Call (ADB/Fastboot/Signer)
4. Start/Stop (ADB/Fastboot)
5. Reboot (ADB/Fastboot)
6. DeviceConnectionMonitor
7. Device state check
8. Send KeyEvents (ADB)
Problems & Solutions
1. Windows 8.x | 10.x
NOTE
If u use any callback functions, u have to invoke any UI-/ variable-interaction from an dispatcher like the following example:
Code:
public void Monitor(Added|Changed|Removed)EventHandler(object sender, Monitor(Added|Changed|Removed)EventArgs e)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// IDeviceInfo[] e.Devices
// Here u can interact with an UI-Element or an variable in ur program code
});
}
if u do it without dispatcher, u'll get an "Thread Exception".
More examples coming soon...
(If u need a specific example, just let me know, i'll try my best to provide one.)
Changelog
DD.MM.YYYY | (A) = Added | (C) = Changed | (D) = Deleted | (F) = Fixed | (R) = Recoded | (U) Updated
----------------------------------------------------------------------------------------------------------------------------------------------------
26.07.2020 [7.0.46.0]
(A) Some new Async overloads to the AFileInfo, AFileSystemInfo, ADirectoryInfo and AMountpointInfo.
(F) A few little bugs
01.02.2020 [6.7.46.0]
(A) ADB.IADBClient{} (The old IADB interface)
(A) ADB.Binary.ADB{} (The old ADB class - only the statics)
(A) ADB.Binary.ADBClient{} (The old ADB class - without any statics)
(A) ADB.Socket.ADB{} (The old ADB class - only the statics)
(A) ADB.Socket.ADBClient{} (The old ADB class - without any statics)
(A) ADB.Device.ADirectoryInfo{}
(A) ADB.Device.AFileInfo{}
(A) ADB.Device.AFileStream{}
(A) ADB.Device.AMountPointInfo{}
(A) ADB.Device.FileSystemCache{}
(A) ADB.Device.IFileSystemCache{}
(D) ADB.Device.Directories{}
(D) ADB.Device.Files{}
(D) ADB.Device.FileSystem{}
(D) ADB.Device.FileSystemItem{}
(D) ADB.Device.IFileSystemItem{}
And everything related to those classes... Directories has been replaced with ADirectoryInfo, Files has been replaced with AFileInfo and FileSystem has been replaced with AMountPointInfo.
31.05.2019 [6.0.46.0]
(C) The Framework Version from 4.0 to 4.6
(C) The versioning:
6 = Major
0 = Minor
46 = Framework Version (4.6)
0 = Hotfix
(A) (int) ADB.Instance().Device.Screen.GetAutoBrightness()
(A) (int) ADB.Instance().Device.Screen.GetBrightness()
(A) (ScreenBrightnessMode) ADB.Instance().Device.Screen.GetBrightnessMode()
(A) (ScreenRotation) ADB.Instance().Device.Screen.GetRotation()
(A) (ScreenRotationMode) ADB.Instance().Device.Screen.GetRotationMode()
(A) (bool) ADB.Instance().Device.Screen.SetBrightness(int brightness)
(A) (bool) ADB.Instance().Device.Screen.SetBrightnessMode(ScreenBrightnessMode mode)
(A) (bool) ADB.Instance().Device.Screen.SetRotation(ScreenRotation rotation)
(A) (bool) ADB.Instance().Device.Screen.SetRotationMode(ScreenRotationMode mode)
(D) ASDK (enum)
(C From) (ASDK) ADB.Instance().Device.GetSDK()
(C To) (int) ADB.Instance().Device. GetSDK()
10.04.2019 [0.0.5.2]
(A) A workaround for older SU binaries
Code:
// (Source ADB.Device.Su {})
///<summary>
/// Enables an (W)ork(A)round for older SU binaries, which needs the command as an single argument.
///<para/>For example, the latest SU binaries support a syntax like [su -c id -u] where older binaries need [su -c "id -u"]
///<para/>If u deactivate this workaround by enabled <see cref="IADB.UseSu"/>, <see cref="IADB.UseSu"/> gets also disabled!
///<para/>This workaround is by default disabled
///<para/>Affected Methods:
///<para/><see cref="ShellCmd(string, int)"/>, <see cref="ShellCmd(string, CancellationToken, int)"/>, <see cref="ShellCmd(string, ShellDataEventHandler, int)"/>, <see cref="ShellCmd(string, ShellDataEventHandler, CancellationToken, int)"/>
///<para/><see cref="ShellCmdHRes(string, int)"/>, <see cref="ShellCmdHRes(string, CancellationToken, int)"/>, <see cref="ShellCmdHRes(string, ShellDataEventHandler, int)"/>, <see cref="ShellCmdHRes(string, ShellDataEventHandler, CancellationToken, int)"/>
///</summary>
public bool WA_SingleArgument
(A) A fix for unresponsive interactive shells. This happened to me on Lineage on my HTC Sensation, where the device sends an "resize" request... Sending a command in this state caused the command getting cut at the 1st byte, for example, u send "id -u" the delivered command was "d -u".
(A) Added "feature" detection for Binary.ADB, now u can get the "features" of the device like: cmd, stat, stat_v2, shell, shell_v2, etc. in the "IChannel.Features".
(R) Removed the last bit of code duplication and optimized some internal logic's. For example, the "Socket.IChannel" got a speed boost from ~1.920.000 bytes during an transfer of 14.400.000 bytes.
06.03.2019 [0.0.5.1]
(C) ADB.Device structure (see 1st post)
(R) ADB.Device.Provider (Decreased the loading time of the contacts and their data)
(D) AAPT completely
Older Changes:
16.02.2019 [0.0.4.2]
(A) DNS lookup for ADB.Socket
(R) Reduced code duplication
07.02.2019 [0.0.4.1]
(F) An issue inside the ADB.Binary, the problem was that "ADB.Devices()" returned nothing, if more than one device was connected. Reason for the issue was the "(int)IChannel.ReadHexLength()" function, there i read an Int16 but it was an UInt16 which caused an overflow.
29.01.2019 [0.0.4.0]
(U) AAPT, ADB, Fastboot binaries and the required dlls to the latest version (1.0.40)
(A) ADB.ADBridge - Unified access to ADB.Binary and ADB.Socket
(A) ADB.IADB - Interface for ADB-/Socket with nearly all ADB commands
(A) ADB.IChannel - Interface of an ADB-/Socket RAW-data channel
(A) ADB.IFramebuffer - Interface for the ADB-/Socket framebuffer
(A) ADB.IShell - Interface for the ADB-/Socket Shell v1 & v2
(A) IMonitor - Interface for the ADB-/Socket and Fastboot device-monitor
(A) On-the-fly device to device copy (ADB.Binary <-> ADB.Binary | ADB.Binary <-> ADB.Socket | ADB.Socket <-> ADB.Socket)
Reordered the ADB namespace... The old layout was:
ADB - Binary based ADB
ADB.Device - Device helper
ADBSocket - Socket based ADB
The new layout is:
ADB - Main ADB
ADB.Binary - Binary based ADB
ADB.Device - Device helper
ADB.Shared - Shared helper, extensions for ADB.Binary and ADB.Socket
ADB.Socket - Socket based ADB
Implemented the framebuffer for ADB.Binary and ADB.Socket (A ready-to-go Remote-Desktop is available via my AndroidCtrlUI.dll)
09.04.2018 [0.0.3.1]
This is a complete new version!
-
I added a lot of new stuff like the "CancellationToken" overload, the "MediaScanner" class and also some fine tunes to the "Screen" class, there u can now also get the Screen dimensions. Also a lot models like the old MemDumpxxx_4xx have been removed (we are now 4 versions higher and the outputs are not longer available or have changed to much).
15.02.2018 [0.0.2.5]
(F) A problem where a NULL exception was raised during directory parsing
(F) A few UI freezes and applied a few tweaks to some logic's.
(D) Tools.Icons {}
(D) Tools.TrayNotify {}
Reason for this is the upcoming compatibility to .NET Core. BUT, the functions are not lost, i added those not .NET Core compatible calls to the AndroidCtrlUI.dll... Because the UI dll will be never migrated to .NET Core.
03.11.2017 [0.0.2.4]
Nearly full new build
-
Sadly my notes are lost, based on a data loss on my Dev Environment...
Showcase
ADB-Overlay made by me
The XDA-Thread and Download can be found here
P10 Lite Toolkit made by me
The XDA-Thread and Download can be found here
P9 Lite Toolkit made by me
The XDA-Thread and Download can be found here
HTC One Toolkit from our Member @squabbi
The XDA-Thread and Download can be found here
--
U use this dll in ur project?
Send me a PM with:
Project Name
Small image
Short description
Download link
then i'll link it here.
An interesting library, time to change Droid Manager code base to use this one ^__^
Thanks for your hard work :highfive:
Could you put an example of how to use the adb and fastboot commands?
such as adb reboot
and fastboot reboot
squabbi said:
Could you put an example of how to use the adb and fastboot commands?
such as adb reboot
and fastboot reboot
Click to expand...
Click to collapse
Yup i'll do it right now
#EDIT:
Added:
Start/Stop ADB/Fastboot
Check if ADB/Fastboot is running
Device Reboot ADB/Fastboot
Sending KeyEvents ADB
Hey another question. How would I use for example:
Code:
Fastboot.Instance().OEM.ReadCid();
I would presume there would need to be a 'string' for it to save to.
Code:
private string _cid
??
EDIT: So i deciced to try this:
Code:
MessageBox.Show("cid: " + Fastboot.Instance().OEM.ReadCid());
When I press the button it shows:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Thanks!
squabbi said:
Hey another question. How would I use for example:
Code:
Fastboot.Instance().OEM.ReadCid();
I would presume there would need to be a 'string' for it to save to.
Code:
private string _cid
??
EDIT: So i deciced to try this:
Code:
MessageBox.Show("cid: " + Fastboot.Instance().OEM.ReadCid());
When I press the button it shows:
Thanks!
Click to expand...
Click to collapse
Hey there
Methods/functions like "ReadCid()" returns a "List<string>" so u can do like:
Code:
string cid = string.Join(" ", Fastboot.Instance().OEM.ReadCid().ToArray());
// or
// The return are 3 lines, so we need to get the 2cnd
string cid = Fastboot.Instance().OEM.ReadCid()[1];
NOTE
I return there a "List<string> (the raw output)" coz i dun know if the output will be the same on each device.
In this case u have filter the right line ur self
Hope this helps
k1ll3r8e said:
Hey there
Methods/functions like "ReadCid()" returns a "List<string>" so u can do like:
Code:
string cid = string.Join(" ", Fastboot.Instance().OEM.ReadCid().ToArray());
// or
// The return are 3 lines, so we need to get the 2cnd
string cid = Fastboot.Instance().OEM.ReadCid()[1];
NOTE
I return there a "List<string> (the raw output)" coz i dun know if the output will be the same on each device.
In this case u have filter the right line ur self
Hope this helps
Click to expand...
Click to collapse
Thanks again!
It worked perfectly! Another question. I'm now using a textbox to show the output like this:
Code:
MainWindow mainWin = (MainWindow)App.Current.MainWindow;
mainWin.tBOutput.AppendText(String.Join("", "\n", Fastboot.Instance().OEM.ReadCid()[1]));
mainWin.tBOutput.ScrollToEnd();
How can I do this but in a seperate window? Like one that is seperate from the MainWindow.
Thanks! :good:
squabbi said:
Thanks again!
It worked perfectly! Another question. I'm now using a textbox to show the output like this:
Code:
MainWindow mainWin = (MainWindow)App.Current.MainWindow;
mainWin.tBOutput.AppendText(String.Join("", "\n", Fastboot.Instance().OEM.ReadCid()[1]));
mainWin.tBOutput.ScrollToEnd();
How can I do this but in a seperate window? Like one that is seperate from the MainWindow.
Thanks! :good:
Click to expand...
Click to collapse
Hey there
There are 3 and more options how u can handle this...
1. Simple "MessageBox"
Code:
MessageBox.Show(string.Join("\n", Fastboot.Instance().OEM.ReadCid().ToArray()));
2. Extra Window
XAML
Code:
<Window x:Class="Multi_Explorer.viewmodel.android.fastboottools.htc.CidDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Show CID" Height="410" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid>
<RichTextBox x:Name="TokenOutput" IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
</RichTextBox.Resources>
<FlowDocument>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>
CS
Code:
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
namespace Multi_Explorer.viewmodel.android.fastboottools.htc
{
/// <summary>
/// Interaktionslogik für CidDialog.xaml
/// </summary>
public partial class CidDialog : Window
{
#region Instance
private static CidDialog _instance = null;
public static CidDialog Instance
{
get
{
if (_instance != null)
{
return _instance;
}
else
{
_instance = new CidDialog();
return _instance;
}
}
}
#endregion
public CidDialog()
{
InitializeComponent();
this.Closing += WindowClosing;
App.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
}
#region WindowClosing
///<summary>
/// Clean exit
///</summary>
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
_instance = null;
}
#endregion
#region Add
public void Add(List<string> msg)
{
foreach (string tmp in msg)
{
TokenOutput.Document.Blocks.Add(new Paragraph(new Run(tmp)));
}
TokenOutput.ScrollToEnd();
}
#endregion
#region Clear
public void Clear()
{
TokenOutput.Document.Blocks.Clear();
}
#endregion
}
}
Usage
Code:
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.ReadCid());
// As window
ciddiag.Show();
// As dialog window (this will freeze the complete application until it's closed)
ciddiag.ShowDialog();
3. Extra Window with ADB/Fastboot instance
XAML
Code:
<Window x:Class="Multi_Explorer.viewmodel.android.fastboottools.htc.CidDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Show CID" Height="410" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid>
<RichTextBox x:Name="TokenOutput" IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
</RichTextBox.Resources>
<FlowDocument>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>
CS
Code:
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
using AndroidCtrl;
using AndroidCtrl.ADB;
using AndroidCtrl.Tools;
using AndroidCtrl.Fastboot;
namespace Multi_Explorer.viewmodel.android.fastboottools.htc
{
/// <summary>
/// Interaktionslogik für CidDialog.xaml
/// </summary>
public partial class CidDialog : Window
{
public CidDialog()
{
InitializeComponent();
this.Closing += WindowClosing;
App.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
// If u have a selected device this will work in all sub-windows
Add(Fastboot.Instance().OEM.ReadCid());
}
#region WindowClosing
///<summary>
/// Clean exit
///</summary>
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
_instance = null;
}
#endregion
#region Add
public void Add(List<string> msg)
{
foreach (string tmp in msg)
{
TokenOutput.Document.Blocks.Add(new Paragraph(new Run(tmp)));
}
TokenOutput.ScrollToEnd();
}
#endregion
#region Clear
public void Clear()
{
TokenOutput.Document.Blocks.Clear();
}
#endregion
}
}
Usage
Code:
CidDialog ciddiag = CidDialog.Instance;
// Optional
// ciddiag.Add(Fastboot.Instance().OEM.ReadCid());
// As window
ciddiag.Show();
// As dialog window (this will freeze the complete application until it's closed)
ciddiag.ShowDialog();
k1ll3r8e said:
Hey there
There are 3 and more options how u can handle this...
Click to expand...
Click to collapse
Thanks for clarifying! What if i want to get the identifier code? it has multiple strings? how can i choose to show all of them?
EDIT: (More questions! )
Is it possible to use:
Code:
foreach (DataModelDevicesItem device in adbDevices)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// here goes the add command ;)
deviceselector.Items.Add(device);
});
}
foreach (DataModelDevicesItem device in fastbootDevices)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
deviceselector.Items.Add(device);
});
}
to check if the device is in fastboot or adb? e.g
I press a button to flash recovery. i can have my phone in adb or fastboot and it will check to see which it is in. Then it wil lcarry out a specific command?
Hey there
squabbi said:
Thanks for clarifying! What if i want to get the identifier code? it has multiple strings? how can i choose to show all of them?
Click to expand...
Click to collapse
If u mean the HTC-Bootloader unlock code, u can use the described 2 or 3.
(Both window examples have an "foreach loop" to print out each line from the List<string> into the RichTextBox)
If u want also replace the "(bootloader) " tag u can use this line:
Code:
TokenOutput.Document.Blocks.Add(new Paragraph(new Run(tmp.Replace("(bootloader) ", ""))));
just replace it in the CS code with the one in the "foreach loop".
squabbi said:
EDIT: (More questions! )
Is it possible to use:
Code:
foreach (DataModelDevicesItem device in adbDevices)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// here goes the add command ;)
deviceselector.Items.Add(device);
});
}
foreach (DataModelDevicesItem device in fastbootDevices)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
deviceselector.Items.Add(device);
});
}
to check if the device is in fastboot or adb? e.g
Click to expand...
Click to collapse
Yes, so i do it in my projects also.
squabbi said:
I press a button to flash recovery. i can have my phone in adb or fastboot and it will check to see which it is in. Then it wil lcarry out a specific command?
Click to expand...
Click to collapse
For this scenario, u need a function which checks which state have the current device serial. After u have the state ADB or Fastboot, u can call 2 different methods from my dll:
ADB
Code:
// This requires Root in any case!
ADB.Instance().Device.FlashImage(IDDevicePartition partition, string localPath, bool tmpToSD = true, int timeOut = -1);
Fastboot
Code:
Fastboot.Instance().Flash(IDDevicePartition partition, string file, int timeOut = -1);
NOTE
I will build a function which will do the work in the future, next release will include it.
#EDIT:
Release it out
Code:
AndroidCtrl.Tools.General.CheckDeviceState(string deviceID);
// return is a IDDeviceState
Hope this helps
k1ll3r8e said:
Hey there
If u mean the HTC-Bootloader unlock code, u can use the described 2 or 3.
(Both window examples have an "foreach loop" to print out each line from the List<string> into the RichTextBox)
If u want also replace the "(bootloader) " tag u can use this line:
Code:
TokenOutput.Document.Blocks.Add(new Paragraph(new Run(tmp.Replace("(bootloader) ", ""))));
just replace it in the CS code with the one in the "foreach loop".
Yes, so i do it in my projects also.
For this scenario, u need a function which checks which state have the current device serial. After u have the state ADB or Fastboot, u can call 2 different methods from my dll:
ADB
Code:
// This requires Root in any case!
ADB.Instance().Device.FlashImage(IDDevicePartition partition, string localPath, bool tmpToSD = true, int timeOut = -1);
Fastboot
Code:
Fastboot.Instance().Flash(IDDevicePartition partition, string file, int timeOut = -1);
NOTE
I will build a function which will do the work in the future, next release will include it.
#EDIT:
Release it out
Code:
AndroidCtrl.Tools.General.CheckDeviceState(string deviceID);
// return is a IDDeviceState
Hope this helps
Click to expand...
Click to collapse
Hey there!
Im using this for the output:
Code:
IDDeviceState state = General.CheckDeviceState(ADB.Instance().DeviceID);
if (state == IDDeviceState.DEVICE)
{
ADB.Instance().Reboot(IDBoot.BOOTLOADER);
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.GetIdentifierToken());
ciddiag.Show();
}
else if (state == IDDeviceState.FASTBOOT)
{
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.GetIdentifierToken());
ciddiag.Show();
}
When I first press the button the output window shows. When I close it and press the button again it gives me this error - even if I wait a couple of seconds.
Thanks for your help! :fingers-crossed::good:
squabbi said:
Hey there!
Im using this for the output:
Code:
IDDeviceState state = General.CheckDeviceState(ADB.Instance().DeviceID);
if (state == IDDeviceState.DEVICE)
{
ADB.Instance().Reboot(IDBoot.BOOTLOADER);
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.GetIdentifierToken());
ciddiag.Show();
}
else if (state == IDDeviceState.FASTBOOT)
{
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.GetIdentifierToken());
ciddiag.Show();
}
When I first press the button the output window shows. When I close it and press the button again it gives me this error - even if I wait a couple of seconds.
Thanks for your help! :fingers-crossed::good:
Click to expand...
Click to collapse
Hey there
oh yes, that is my fault
U have to add this to ur Window constructor "CidDialog(){}"
Code:
this.Closing += WindowClosing;
And this is the "WindowClosing method"
Code:
#region WindowClosing
///<summary>
/// Clean exit
///</summary>
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
_instance = null;
}
#endregion
Explain
"CidDialog.Instance" create a new instance of the window. But on close the instance will not be set to null. So u can't open it again, coz the system think it's still open.
Hope this helps
#EDIT:
I updated the examples 2 and 3 also.
k1ll3r8e said:
Hey there
oh yes, that is my fault
U have to add this to ur Window constructor "CidDialog(){}"
Code:
this.Closing += WindowClosing;
And this is the "WindowClosing method"
Code:
#region WindowClosing
///<summary>
/// Clean exit
///</summary>
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
_instance = null;
}
#endregion
Explain
"CidDialog.Instance" create a new instance of the window. But on close the instance will not be set to null. So u can't open it again, coz the system think it's still open.
Hope this helps
#EDIT:
I updated the examples 2 and 3 also.
Click to expand...
Click to collapse
Thanks a lot man! Time to put everything in full motion! ?
Sent from my HTC One_M8 using Tapatalk
squabbi said:
Thanks a lot man! Time to put everything in full motion! ?
Sent from my HTC One_M8 using Tapatalk
Click to expand...
Click to collapse
Np dude
Good Luck!
Hey there! I may be over looking, but where can I use the 'fastboot boot image.img' command?
Thanks!
squabbi said:
Hey there! I may be over looking, but where can I use the 'fastboot boot image.img' command?
Thanks!
Click to expand...
Click to collapse
Hey bro,
I dun implemented it sry... Next build will include it.
Upload starts tonight
Sent from my HTC Sensation using XDA Free mobile app

Howto: Android 11 @ Freeradius on Fedora29 Server

Hey there,
a view days ago I 'll had installed the Lineage OS 18.1 in to an tablet Samsung SM-T555.
All works fine an the consume of the battery is good, thanks without G-Apps. My elementary problem is:
I have access pointers an these are connected with my server, for authenticity I'll used freeradius on fedora server.
With the Android 10 ( Lineage 17.1 ) I 'm able to log in to my wifi network. I'm typing the username, password and no certificating the certificates.
In the Android 11 ( Lineage 18.1 ), there is an grade different, the system will be or must be have type an Domain for log into the wifi network with radius.
Can I change on the easy way the configuration on the Android 11? Or I will have to change the server configuration on the radius?
The problem is, this a lot of work for me, because, the documentation for this theme is not so good or bad. And takes a lot of time for me.
Has anybody an good idea, for solving this problem?
Greetings tiptel170
1. create certs:
/etc/raddb/certs/
ca.cnf, client.cnf, inner-server.cnf and server.cnf must be adapted according to your own system specifications.
In the files *.cnf at communName must be entered a FQDN, except in the ca.cnf, server.cnf, inner-server.cnf and client.cnf must be entered in each case another name,
but this must be resolvable with the server.
Execute
Code:
./bootstrap
2. /etc/raddb/radius.conf adjust the file paths
Code:
prefix = /usr
exec_prefix = /usr
sysconfdir = /etc
localstatedir = /var
sbindir = /usr/sbin
logdir = ${localstatedir}/log/radius
raddbdir = ${sysconfdir}/raddb
radacctdir = ${logdir}/radacct
#
# name of the running server. See also the "-n" command-line option.
name = radiusd
# Location of config and logfiles.
confdir = ${raddbdir}
modconfdir = ${confdir}/mods-config
certdir = ${confdir}/certs
cadir = ${confdir}/certs
run_dir = ${localstatedir}/run/${name}
db_dir = ${localstatedir}/lib/radiusd
3. /etc/raddb/mods-available/eap comment out these lines and paste the password from /etc/raddb/certs/ca.cnf into this file.
Code:
eaþ {
....
pwd {
group = 19
server_id = servername.domain.home
fragment_size = 1020
virtual_server = "inner-tunnel"
}
tls-config tls-common {
...
private_key_password = whatyouwant
private_key_file = ${certdir}/server.key
certificate_file = ${certdir}/server.pem
ca_file = ${cadir}/ca.pem
dh_file = ${certdir}/dh
random_file = /dev/urandom
ca_path = ${cadir}
tls_min_version = "1.0"
tls_max_version = "1.3"
...
}
/etc/raddb/mods-available/ntlm_auth
Code:
exec ntlm_auth {
wait = yes
program = "/usr/bin/ntlm_auth --request-nt-key --domain=SMB01 --username=%{mschap:User-Name} --password=%{User-Password}"
}
** --domain=SMB01 -> change accordingly
4. change permissions to allow the Radius server to read the pipe file.
Code:
usermod -a -G root radiusd
chown root:root /var/lib/samba/winbindd_privileged/
5. in the /etc/raddb.bck/mods-available/mschap add these lines.
mschap {
Code:
....
require_encryption = yes
require_strong = yes
with_ntdomain_hack = yes
ntlm_auth = "/usr/bin/ntlm_auth --request-nt-key --username=%{mschap:User-Name:-None} --domain=%{%{mschap:NT-Domain}:-SMB01} --challenge=%{mschap:Challenge:-00} --nt-response=%{mschap:NT-Response:-00}
winbind_domain = "%{mschap:NT-Domain}"
.....
}
** }:-SMB01} -> modify accordingly.
6. /etc/raddb/sites-available/default
Code:
authenticate {
...
ntlm_auth
...
}
7. /etc/raddb/sites-available/inner-tunnel and default
Code:
authenticate {
...
ntlm_auth
Auth-type LDAP {
ldap
}
...
}
8. /etc/raddb/sites-available/ldap
Code:
ldap {
server = '192.168.0.1' }
base_filter = "(objectclass=posixAccount)"
base_dn = 'ou=myserver,dc=home,dc=net'
identity = 'cn=manager,dc=home,dc=net
password = Secret
...
}
9. it is very important that the user has been stored in the ldap database as a unix user and also as a windows user and so has the password, otherwise the ntlm authentication will not work!
Create new:
Code:
smbldap-useradd -am [username]
smbldap-passwd -su [username]
Change:
Code:
smbldap-usermod -a [username]
smbldap-passwd -su [username]
Settings for Android clients 9, 10 and 11 (Lineage OS)
1. install the certificates:
- Transfer the certificates client.pem, client.p12, client.csr, ca.der, ca.key and ca.pem to the tablet or phone.
- Settings -> Wireless networks -> Advanced WLAN settings -> Advanced -> Select Install certificates.
-> Select the file client.p12 and enter the password from the client.cnf, in the pulldown menu - Wifi - select, then a long number and letter combination appears in the name field, this then
change this to a meaningful name.
-> Afterwards select the ca.pem and assign a name.
2. select the WLan where the tablet / cell phone should log in.
- First delete the old connection of the WLan to avoid possible errors.
- Method EAP: PEAP, Login for phase 2: MSCHAPV2, CA Certificate: ( here from step 1, select the name from the ca.pem file ), Online Certificate Status: Not validate, Domain ( from the server.cnf, commonName )
enter the server name ( FQD ), it must be resolvable in the network,
- Identity: username - the one stored in the central user database.
- Anonymous identity, remain here in this case free - do not enter anything.
- Password: is clear, from the user database.
3. save or connect antipen, then the mobile device should be able to log in to the WLan.
Important for Android 11: The ca.pem file, will be deleted after the 3 failed attempt from the system again, then you have to import the ca.pem again into the system!
Check:
radtest user password 192.168.0.1 1812 pwd from the clients.conf
radtest -t mschap user password 192.168.0.1 1812 pwd from the clients.conf
ntlm_auth --request-nt-key --domain=MYDOMAIN --username=user --password=password
tiptel170 said:
Hey there,
a view days ago I 'll had installed the Lineage OS 18.1 in to an tablet Samsung SM-T555.
All works fine an the consume of the battery is good, thanks without G-Apps. My elementary problem is:
I have access pointers an these are connected with my server, for authenticity I'll used freeradius on fedora server.
With the Android 10 ( Lineage 17.1 ) I 'm able to log in to my wifi network. I'm typing the username, password and no certificating the certificates.
In the Android 11 ( Lineage 18.1 ), there is an grade different, the system will be or must be have type an Domain for log into the wifi network with radius.
Can I change on the easy way the configuration on the Android 11? Or I will have to change the server configuration on the radius?
The problem is, this a lot of work for me, because, the documentation for this theme is not so good or bad. And takes a lot of time for me.
Has anybody an good idea, for solving this problem?
Greetings tiptel170
Click to expand...
Click to collapse
tiptel170 said:
Hey there,
a view days ago I 'll had installed the Lineage OS 18.1 in to an tablet Samsung SM-T555.
All works fine an the consume of the battery is good, thanks without G-Apps. My elementary problem is:
I have access pointers an these are connected with my server, for authenticity I'll used freeradius on fedora server.
With the Android 10 ( Lineage 17.1 ) I 'm able to log in to my wifi network. I'm typing the username, password and no certificating the certificates.
In the Android 11 ( Lineage 18.1 ), there is an grade different, the system will be or must be have type an Domain for log into the wifi network with radius.
Can I change on the easy way the configuration on the Android 11? Or I will have to change the server configuration on the radius?
The problem is, this a lot of work for me, because, the documentation for this theme is not so good or bad. And takes a lot of time for me.
Has anybody an good idea, for solving this problem?
Greetings tiptel170
Click to expand...
Click to collapse
Hello, I am looking for a stable Rom for my Sm-t555. Can you tell me how you got a custom rom on your tablet? I can't find anything unfortunately.

Categories

Resources