yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] Krystanos:
Hello there,

I've been giving it a shot this morning. At first I could not see my device, but it was because I had not yet ADB driver on this desktop, and USB debug mode was not enabled. Now I can see them.

Just a small question: when the DeviceMonitor detect a new device, I can only see the Serial. Model and Product are empty with my Nexus 5.

Another question: would it be possible to have an IOC oriented lib, instead of the static stuff? It would also help to Mock the lib... I know this is not a priority, but it costs nothing to ask ;)

And last one: What is the JRE for in the requirements list?

I'll continue testing all the lib, but it seems pretty cool for now. Thanks for this job :)
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey there,

About the DeviceMonitor, so far i can say, it depends on the device ADB registration. Simple test, open cmd and type "adb devices -l" and check the output.

This is my output...

List of devices attached
192.168.2.3:5555 device product:htc_pyramid model:HTC_Sensation device:pyramid
ip/serial state product model device

// just as info i use this line to parse the items (I use only regex's to filter and parse in my dll's.)
public const string devices_line = @"^(?<SERIAL>.*?)\s{1,}(?<STATE>.*?)(\s{1,}product:\s{0,}(?<PRODUCT>.*?))?(\s{1,}model:\s{0,}(?<MODEL>.*?))?(\s{1,}device:\s{0,}(?<DEVICE>.*?))?$";

This values are shown in DeviceMonitor, if ur device dun show them in "adb devices -l" my code can't find them. :p

About the "IOC", i'll remove today the most "sealed" statements. But in a few classes i can't remove it (just as info). Also i dun know if i break eventually the "Thread-Safety" if i unseal some "[MethodImpl(MethodImplOptions.Synchronized)]" invoked instances. But i'll check it out! ;)

Hope this helps!

And T H X for UR feedback! :)

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] Krystanos:
Indeed, the ADB command gives nothing either:

List of devices attached
06efa3500c47dae unauthorized

About the IOC concern, you could bypass the issue by using interfaces, and keeping the Instance property in the implementation to return the interface, which would be registred in the IOC container. You could keep the sealed class if they all implement interfaces. But I know this is a difficult step for an API. Being IOC compliant will make the API more complicated for non IOC apps.

And it won't save your thread safety, but neither will the static stuff :)

You could just tell that your lib is not thread safe, and this is the custody of the developper to be sure it's not accessed in an not thread safe environment...
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey there,

about the DeviceMonitor info, just auth ur device! :) - Then u'll see more. (Never show ur real serial in the public i-net! pls, edit and remove ur serial!)

About the "IOC", i'm nearly done. ;) - Nearly all classes are no longer sealed. Now u have now 2 ways to get an class instance, 1st) just use the way like before, 2cnd) call the needed class with "ADB = null" will tell the class to use the Instance() "selected" device or pass "ADB = Ur.Instance()" will tell the class to use the given instance.

How ever... - Now u can now extend nearly all classes like "public class MyNewClass : ADB.Device.Device {}" for example.

Hope this helps. :)

PS: About the "Interfaces" i hate to code those!!! :D :p

PPS: Update goes online tonight!

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] Krystanos:
I have seen the control on my phone just about half an hour ago, I've been working on other concerns for the app :)

Now I can see every properties.

And nothing to worry, the device ID I have written is of course randomly generated, and not the real one.

Too bad for the interfaces, but at least, I can wrap your wrapper and create interfaces to be able to use IOC :)
[Android Software/Hacking General [Developers Only]] Krystanos:
Just a hi,

I have finished my shell for the app, so now there is only "real" code to do. Not much time to dev after work though.

I'll keep in touch, but don't expect daily reports ;)

Also, I think I wont use all the possibilities of the lib... But, I will certainly have a look at the WPF components...
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey there,

THX a lot for giving this lib a real try! :)

-

About report, nah we don't need daily reports. :p - But, sometimes a bit feedback will be really nice! ;)

About the WPF components, i'll include in the next time some new ViewModels for, for example flash an apk or use the Andoid-Build-In-Backup, etc.

But also THX for testing my other lib! ;)

As always, if u need some new features or something went wrong with my lib, just contact me and we get the devil out there! ;)

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] Krystanos:
Hey there,

I have a weird behavior with the latest version (oct. 6th). I can't detect my device anymore.

I have updated your lib, and installed the latest ADB Installer (1.4.1).

ADB can see my device (screenshot 1).

But my app does not... What's strange is that I have not changed the behavior. Here is a quick extract:

public DeviceMonitor()
{
this.devices = new Dictionary<string, Device>();
ADB.ConnectionMonitor.Callback += this.OnDevice;
if (!ADB.ConnectionMonitor.IsStarted())
{
ADB.ConnectionMonitor.Start();
}
}

...

private void OnDevice(object sender, ConnectionMonitorArgs e)
{
foreach (var device in e.Devices)
{
var ldevice = new Device();
ldevice.Id = device.Device;
ldevice.Ip = device.IP;
ldevice.Mode = device.Mode;
ldevice.Model = device.Model;
ldevice.Product = device.Product;
ldevice.Serial = device.Serial;
ldevice.State = device.State.ToString();
devices[ldevice.Id] = ldevice;

if (this.internalDevice != null)
{
this.internalDevice(ldevice);
}

}
}

...

The "OnDevice" callback is never called.

Is there changes on the behavior of the lib? Or incompatibility with latest ADB installer? Or something else? How can I trace what happens? Any idea?

Further thought after that : it would be great to include a logging interface, so your lib can raise logs in whatever implementation is used by developper. Common.Logging maybe?

Also, I think again about what I proposed you : some way (if possible) to auto-diagnose the system (driver, Java or something else missing? Link broken with some middleware?)

Thanks :)
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey there,

sad to hear this... But, i have nothing changed on the "ConnectionMonitor"... here is my current working code from my "AndroidCtrlUI.dll" which uses this class also.

if (ADB.ConnectionMonitor.IsStarted())
{
if (ADB.ConnectionMonitor.Stop())
{
ADB.ConnectionMonitor.Start();
}
}
else
{
ADB.ConnectionMonitor.Start();
}
ADB.ConnectionMonitor.Callback += ConnectionMonitorCallback;

if (Fastboot.ConnectionMonitor.IsStarted())
{
if (Fastboot.ConnectionMonitor.Stop())
{
Fastboot.ConnectionMonitor.Start();
}
}
else
{
Fastboot.ConnectionMonitor.Start();
}
Fastboot.ConnectionMonitor.Callback += ConnectionMonitorCallback;

private void ConnectionMonitorCallback(object sender, ConnectionMonitorArgs e)
{
Application.Current.Dispatcher.Invoke((Action)delegate
{
// Do some stuff
});
}

Maybe, u have forgotten to use the "Dispatcher"... This is on my side often the issue^^ - I start a new upload in the next 15 min. maybe a corrupt file...

Another problem can be have u the folder "adb" beside the dll or does u use a external adb? If so, have u set the dll internal vars to the external "adb" directory?

ADB.PATH_DIRECTORY_ADB = "C:\\adb";
AAPT.PATH_DIRECTORY_AAPT = "C:\\adb";
Signer.PATH_DIRECTORY_SIGNER = "C:\\adb";
Fastboot.PATH_DIRECTORY_FASTBOOT = "C:\\adb";

About the logging, good idea! I'll look what i can do in the next build.

Hope this fix ur issue :) - If not, pls let me know!

Regards,

Sebastian

EDIT: New build is out!
[Android Software/Hacking General [Developers Only]] Krystanos:
Just to reply to your source. Does your ADB connection monitor stores the received devices ?

If not, you have a potential race condition by subscribing to the event after the service is started :)

I have the issue on my laptop, I'll try on my desktop... I don't think this is a dispatcher issue, but I'll have to improve this part anyway...

And I'll try the latest version :)

I indeed use an external ADB, and the variables are not set. I'll check that too. But I did not set them on my desktop either... Weird.
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey there,

yes the "ConnectionMonitor" store the devices until they change, so i determine if an device is connected or disconnected. :)

(Maybe that can also be an issue... But, if u "Stop()" it and then "Start()" it, it will get an fresh list.)

About ur "Desktop-PC", have u there an "adb" folder beside the dll? If so, there will be the "no error" issue ^^ :p (dun know how to say that better^^ *Tooooo late for english sry...*)

About the "Logging", i have just include a little small logging module.

// Top of ur .cs
...
using AndroidCtrl.Logging;
...

Logger.Activate = true; //default is false
Logger.WriteParts = true; //default is false

About the logs, currently are only the "ProcessModels" namespace got the "Log-Writer" on the other classes i'll work later. But, so u can determine if the issue comes from an none reachable "adb.exe or fastboot.exe".

Hope this helps u a bit. :)

PS: Build with "Logging-Module" is out! ;)

Regards,

Sebastian

EDIT:

U can also use...

Tools.Deploy.ADB();

...this will deploy the dll internal adb tools. ;)
[Android Software/Hacking General [Developers Only]] Krystanos:
Yeah, I asked myself about this deploy yesterday, but switched on something else so I forgot. It's still pretty obscur to me, I should definitely have to know how ADB and Fastboot work in the first place... Not knowing this makes the use of AndroidCtrl more difficult... But I'm not the "standard" target of this lib though :)

This is definitely an issue on my side, it's not working anymore on my desktop either. I have reverted AndroidCtrl, and the ADB driver, but I have the same issue. Soooooo, issue comes from my code...

On a short term, yes! However, on a longer term, I would advise to let the implementation of log to the user, and let him inject the logger in your code. It will avoid trying to write logs in an readonly app folder. I know this is a far concern, but it will be easier to do it at the beginning than to refactor after that :)

You can use this : https://www.nuget.org/packages/Common.Logging

And if you want to really have logs in your app (or me in mine), you can inject at runtime an implem such as this one: https://www.nuget.org/packages/Common.Logging.Log4Net/

Also, if you could change your version number, it would be easier to keep track of them ;D

I'll continue in a few days and keep you informed :)

Thanks again !
[Android Software/Hacking General [Developers Only]] Krystanos:
No more luck with Tools Deploy.

I have the adb folder in the output of the project.

And I have activated the logs, but there's no file generated. Maybe it's generated in another place?
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey there,

the logfile will be generated beside the "AndroidCtrl.dll" and is named "AndroidCtrl-Log.txt".

On my side all is working fine... If u want i can give u TeamViewer access so u can have a look at my code. ;)

EDIT:

I have tested my app "Multi-Explorer" now just for fun in "WinXP (32/64),Vista (32/64) and 7 (32/64)" in all versions no probs... I can create logs if something went wrong e.g. no "adb" folder, and my device will be found via ConnectionMonitor.

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] Krystanos:
Still moving on, slowly though.

I can now navigate my device. I will test your AndroidCtrlUI to maybe replace my test explorer.

I have a question though. What does exactly ADB.Deploy() do?

When I restart my app, I have an AccessViolationException on this method. I have to reboot my PC to be able to call it again, or just catch the exception.

I think I'm missing something on disposing. I call ADB.DeviceMonitor.Stop() and ADB.Stop().

Is ADB.Deploy starting another process that could be zombie if not correctly stopped?

Thanks :)
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey there,

the ADB.Deploy() only deploy the needed "adb.exe, aapt.exe, fastboot.exe, AdbWinApi.dll and AdbWinUsbApi.dll".

(But, it checks before, if the files exists, if so, it will delete the old files and replace it with the dll internal ones.)

Maybe, u call the ADB.Deploy() all the time ur app starts, but the ADB-Server it self runs still in background?

(U normally need to call this method only 1 time, if there is no ADB available on the system u working on. The files will not be delete by my dll after ur app is closed. So for the start u dun need to call it again.)

About the way how u "Dispose" the ADB class, just use ADB.Dispose(). It's static so no real IDisposable but it will "Stop()" the "ConnectionMonitor" and set the ADB instances to "null".

Hope this helps u :)

EDIT:

I have now rewritten the "Logger" class, it have now 5 events where u can subscribe to. Also i'll add later today an "IntegrityCheck()" so u can easily check if anything is on it's place. ;)

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] Krystanos:
Deploy from where to where?

From what you say, ADB.Deploy() will deploy files somewhere, and start the ADB server? But this server is never stopped? I may miss something here, but I find this quite weird. Is there any reason to not stop the ADB server when the app stops? And how can I know if it's started so I can decide not to start it ? (I guess I just have to not call ADB.Deploy())

OK, so I'm fine here. It's just that the ADB server prevent me from calling Deploy after a restart.

I'll check that. I have not added logging to my app yet. Will do it, it's only a matter of 5 minutes...

Thanks :)
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
The files will be deployed beside the dll. In a directory called "adb".

"Deploy()" will only deploy the files nothing else.... It dun start the server or something. It only extract the dll "internal" adb tools.

About the check, just use "ADB.IsStarted()" it's static and will return true or false.

About the adb server, there is no reason why i dun stop the server, but, if u working like me with different devices (AVD and real one) it's really annoying to restart the server after each program restart. Also i use W-Lan to connect to my device so i dun have to reconnect my device every time... It's still connected if my app dun run, but if i restart it it's directly connected to my device. ;)

EDIT:

Also if the user, which uses ur app, have already another app open which interacts with another device u'll stop also these ADB-Server... That's a reason why i gave the user the chance to decide it him/her self if the server gets stopped or not.

INFO: U can call ADB.Dispose() which will stop server, or u call ADB.Dispose(true) this let the ADB-Server alive.

I think so.

The new build goes tonight online. ;)

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] Krystanos:
OK. From the folder defined by the environment variables.

I'll see if I can handle them as NuGet dependencies. Same goes for Java. It could be more simple for a deployment.

I just have to get a nuget repository now ^^

That makes a lot sense. As long as ADB.Dispose does stop the server, it's fine :)

It's up to me to be able to know if I should stop the server or not...

Thanks for the help.

Cool ! Could you change the version number?

You can also set Visual Studio to auto-increment the version number by modifying the AssemblyInfo.cs:

[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

Thanks ;)
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
"NuGet dependencies" means they will downloaded from somewhere right? Why dun implement a "complete" minimal installer? Coz, what happens if the user have currently or on his machine no I-Net? So the user isn't able to start or even use the app... I think it's better to have the needed files right beside/inside the app. :)

Np :)

Hehe :) - Yes, the version number will change from today! :)

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] Krystanos:
That's the point. NuGet is for DEV, not for user. But it will allow to easily create an installer for the whole dependencies. Except .NET (but it can be integrated) and the driver (same thing). Java and ADB can be deployed with the app.

However, it's a bit overkill, just a dep folder is enough for now, with post build events...

Great!
[Android Software/Hacking General [Developers Only]] Rain_Saeid:
please help for vb.net

Please enter a vb.net example
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey there,

if have never used VB.Net... So I can't give u an example in VB.Net.

But, so far I know there are a few C# to VB.Net converter on the I-Net. Try to convert my example C# code there to VB.Net code. ;)

Edit:

U can use for example this one:

http://www.developerfusion.com/tools/convert/csharp-to-vb/

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] squabbi:
Hi! I used to code in VB.Net but leading a new language shouldn't be too hard! What [MENTION=3753223]k1ll3r8e[/MENTION] has provided will defiantly help you start!

Start with a simple C# WPF application and mess around a bit. ;)
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey all together,

tonight i'll update the aapt.exe, adb.exe, fastboot.exe and the needed dlls, also i have to realign the RegEx parsers i use for internal work coz the outputs have changed a bit...

New build goes (late) tonight or (early morning) tomorrow online!

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] squabbi:
Hey there dude! Long time no speak! ;) how are u?

I would like to ask if it's possible to have a live output of the commands.

Thanks! :)
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hey bro :)

-

I'm fine :) - And u?

What does u mean with live outputs?

U can use for example:

...
using AndroidCtrl;
using AndroidCtrl.ADB;
...

// Get the shell instance
ShellRT _shell = ADB.Instance().ShellRT;

// or a superuser shell
// AndroidCtrl.ADB.Device.SuShellRT _shell = ADB.Instance().Device.Su.ShellRT;

// define the callback for shell response
_shell.Callback += OutputCallback;

// sending an command
_shell.SendCMD("ur command");

// Callback for shell response
public void OutputCallback(object sender, ProcessResponseArgs e)
{
if (String.IsNullOrEmpty(e.Response) == false)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// do what u want with "e.Response"
});
}
}

On other hand u can use Logging.Logger{}.

Hope this helps u :)

EDIT:

For understanding,

ShellRT, SuShellRT and a few other classes inherit RealTimeBG. This will mean u can also directly call RealTimeBG, like this (untested) example:

...
using AndroidCtrl;
using AndroidCtrl.ADB;
using AndroidCtrl.ProcessModels;
...

public class StatusWindow : RealTimeBG
{
public StatusWindow()
{
Exe = ADB.PATH_ADB;
Args = "status-window";
Start();
}
}

// instance of StatusWindow
StatusWindow test = new StatusWindow();

// define the callback for shell response
test.Callback += OutputCallback;

// sending an command
test.SendCMD("ur command");

// Callback for shell response
public void OutputCallback(object sender, ProcessResponseArgs e)
{
if (String.IsNullOrEmpty(e.Response) == false)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// do what u want with "e.Response"
});
}
}
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Contacts & MMS/SMS

Hey all together,

this is only an status update!

The next build includes:

1. SQLite3 database connector | ADB.Instance().Device.SQLite3{}

2. Contacts viewer (The writer will take a bit more time and a few testers, coz the table structure is different between each ROM...)

3. MMS/SMS viewer (For the writer goes here the same as for the contacts, the tables are different between each ROM...)

4. A few fixes, mainly on ProcessModels.General{}, coz there is a bug inside the ExecuteBGStack() method.

------------------------------------------------------------------------------------------------------------------------------------------

New build is out!

About the sms/mms & contact reader, all classes require root access on the device!

-

About the writer, i have currently a very alfa-state writer which i test currently on some AVD's... Hopefully the next version will include it!

And as always, if u find some bugs pls report them! ;)

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] Krystanos:
Nice evolution dude. I'm on standby on my project for now, a big refactoring is ongoing to avoid dependency to a specific lib...
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Hehe THX :),

i do what i can to improve my lib and make it more easier for the developer to get the needed data-sets.

-

Seems u have a lot of work to do?

If u need some help just let me know! ;)

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] squabbi:
Hey buddy! Long time no see! :)

I'm working on my next project and it's going nicely so far.

[IMG="Toolkit Preview"]http://dl-1.va.us.xda-developers.com/3/1/8/8/3/8/9/toolkit_preview.PNG?key=xkfFGcPvMmijLdFL9ezjLA&ts=1425176777[/IMG]

When using:

Fastboot.Instance().OEM.GetIdentifierToken()

how can I export that into a txt file without the (bootloader) and < Please cut following message >.

Thanks for your help! :)
[Android Software/Hacking General [Developers Only]] k1ll3r8e:
Heyho :)

New project, sounds great! If u also want to include an File-Manager view, my AndroidCtrlUI.dll gets an big update these days.

About ur prob, this might be the solution:

List<string> _token = new List<string>();
foreach(string line in Fastboot.Instance().OEM.GetIdentifierToken() )
{
GroupCollection groups = Regex.Match(line, @"^<bootloader>\s{1,}(?<PART>.*?)$").Groups;
string part = groups["PART"].Value;
if (String.IsNullOrEmpty(part) == false && Regex.IsMatch(part, @"^<{1,}.*?>{1,}$") == false)
{
_token.Add(part);
}
}
//the final string which u can write to an file
string token = String.Join("\n", _token.ToArray());

Hope this helps u ;)

Regards,

Sebastian
[Android Software/Hacking General [Developers Only]] squabbi:
More help! :D

Hey friend! Thanks for helping me out! I have a friend to test my current code on the Identifier token.

Now, I remember you gave the code for the connection monitor. I don't think it works now

//This will starte a thread which checks every 10 sec for connected devices and call the given callback
if (Fastboot.DeviceConnectionMonitor(true))
{
//Here we define our callback function which will be raised if a device connects or disconnects
Fastboot.SetDeviceConnectionMonitorCallback = (CallbackDeviceConnectionMonitor)CheckDeviceState;
}

// Here we check if ADB is running and initiate the BASE ADB instance (IsStarted() will everytime check if the BASE ADB class exists, if not it will create it)
if (ADB.IsStarted())
{
//Here we check for connected devices
SetDeviceList();

//This will starte a thread which checks every 10 sec for connected devices and call the given callback
if (ADB.DeviceConnectionMonitor(true))
{
//Here we define our callback function which will be raised if a device connects or disconnects
ADB.SetDeviceConnectionMonitorCallback = (CallbackDeviceConnectionMonitor)CheckDeviceState;
}
}

I tried having a look at other methods, but I couldn't find it. Also does AndroidCtrlUI.dll need AndroidCtrl.dll as well? Do you have an example project for it I could have a look at? :)

Thanks for you help!