Interesting things in APKs in our phones... - Sprint Samsung Galaxy Note II

So in my digging around on garbage to remove... I started digging in ConnectionManager.apk. Several things kind of set me off a bit (code below). I don't claim to know exactly what it does but I can read enough of it to figure I don't want it running on my phone. EdmSysScopeService also had some interesting things in it(third block of code below). So I removed the connectionmanager.apk from the phone since I was reflashing some zips. Apparently that's not a good idea. If you do that, it breaks the Mobile Networks settings menu. So I put it back and just froze it in Titanium Backup for now. Looks like that works and it simply greys out the ConnectionsOptimizer section. I don't need that running on my phone anyways as I can turn on and turn off wifi myself.
Anyone know what the EdmSysScopeService does?
Code:
private boolean isDeviceRooted()
{
boolean bool1 = true;
String str = Build.TAGS;
if ((str != null) && (str.contains("test-keys")));
while (true)
{
return bool1;
try
{
boolean bool2 = new File("/system/app/Superuser.apk").exists();
if (bool2)
continue;
label40: bool1 = false;
}
catch (Throwable localThrowable)
{
break label40;
}
}
}
Code:
package com.birdstep.android.cm.sms;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;
import com.birdstep.android.cm.ESLog;
import com.birdstep.android.cm.UpdaterService;
import com.birdstep.android.cm.config.ConfigXmlParser;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class OperatorMessage extends BroadcastReceiver
{
private static final String ANDROID_PERMISSION_READ_SMS = "android.permission.READ_SMS";
public void onReceive(Context paramContext, Intent paramIntent)
{
if (ESLog.on)
Log.i("EasySmart", "on Receive OperatorMessage OperatorMessage OperatorMessage " + paramIntent.getAction());
ConfigXmlParser localConfigXmlParser = ConfigXmlParser.getConfigXmlParser(paramContext);
if (("android.provider.Telephony.SMS_RECEIVED".equals(paramIntent.getAction())) && (paramContext.getPackageManager().checkPermission("android.permission.READ_SMS", "com.birdstep.android.cm") == 0))
{
Bundle localBundle = paramIntent.getExtras();
if (localBundle != null)
{
Object[] arrayOfObject = (Object[])localBundle.get("pdus");
if (arrayOfObject != null)
{
SmsMessage[] arrayOfSmsMessage = new SmsMessage[arrayOfObject.length];
HashMap localHashMap = new HashMap(arrayOfObject.length);
int i = 0;
if (i < arrayOfSmsMessage.length)
{
arrayOfSmsMessage[i] = SmsMessage.createFromPdu((byte[])(byte[])arrayOfObject[i]);
if (!localHashMap.containsKey(arrayOfSmsMessage[i].getOriginatingAddress()))
localHashMap.put(arrayOfSmsMessage[i].getOriginatingAddress(), arrayOfSmsMessage[i].getMessageBody());
while (true)
{
i++;
break;
String str1 = (String)localHashMap.get(arrayOfSmsMessage[i].getOriginatingAddress());
String str2 = str1 + arrayOfSmsMessage[i].getMessageBody();
localHashMap.put(arrayOfSmsMessage[i].getOriginatingAddress(), str2);
}
}
Iterator localIterator = localHashMap.entrySet().iterator();
while (localIterator.hasNext())
{
Map.Entry localEntry = (Map.Entry)localIterator.next();
if ((((String)localEntry.getKey()).equalsIgnoreCase(localConfigXmlParser.itemString("ExtraOperatorMessageNumber"))) || (((String)localEntry.getKey()).equalsIgnoreCase(localConfigXmlParser.itemString("WisprCredentialsSmsPhoneNr"))) || (((String)localEntry.getKey()).equalsIgnoreCase(localConfigXmlParser.itemString("account_balance_number_sms"))) || (((String)localEntry.getKey()).equalsIgnoreCase(localConfigXmlParser.itemString("topup_number_sms"))))
{
Intent localIntent = new Intent(paramContext, UpdaterService.class);
localIntent.setAction("com.birdstep.cm.ACTION_OPERATOR_SMS_RECEIVED");
localIntent.putExtra("SMSCONTENTS", (String)localEntry.getValue());
localIntent.putExtra("SMSNUMBER", (String)localEntry.getKey());
paramContext.startService(localIntent);
abortBroadcast();
}
}
}
}
}
}
}
Code:
package com.sec.android.app.sysscope.service;
public enum ResultCode
{
private int mCode;
private String mDescription = "";
static
{
ADB_RUNNING_AS_ROOT = new ResultCode("ADB_RUNNING_AS_ROOT", 1, 65537);
PARTITION_TAMPERED = new ResultCode("PARTITION_TAMPERED", 2, 131073);
ROOT_PROCESS_FOUND = new ResultCode("ROOT_PROCESS_FOUND", 3, 12289);
DANGEROUS_FILE_DETECTED = new ResultCode("DANGEROUS_FILE_DETECTED", 4, 262145);
NOT_OFFICIAL_BINARY = new ResultCode("NOT_OFFICIAL_BINARY", 5, 327681);
ResultCode[] arrayOfResultCode = new ResultCode[6];
arrayOfResultCode[0] = OK;
arrayOfResultCode[1] = ADB_RUNNING_AS_ROOT;
arrayOfResultCode[2] = PARTITION_TAMPERED;
arrayOfResultCode[3] = ROOT_PROCESS_FOUND;
arrayOfResultCode[4] = DANGEROUS_FILE_DETECTED;
arrayOfResultCode[5] = NOT_OFFICIAL_BINARY;
}

Not sure, but since the galaxy S3 I've froze all that and much more questionable system apps
.:Sent from my Sprint Galaxy Note II:.

Not sure, but Settings/About/Status shows if the counter has been reset. So there must be code somewhere that populates that field with data.

ffolkes said:
Not sure, but Settings/About/Status shows if the counter has been reset. So there must be code somewhere that populates that field with data.
Click to expand...
Click to collapse
Does this reset back if when you go back to stock?

Hopefully it isnt the newest CarrierIQ....

Well, when I freeze the syscope apk and enterprise syscope apk I get this: Scanning... l'd Put up a pic, but it won't let me.
Sent from my SPH-L900 using xda premium

Carrier IQ anyone? As for the second one it could be for warranty voiding if you root..but I'm no expert
Sent from my Galaxy Nexus using Tapatalk 2

nuc noob said:
Well, when I freeze the syscope apk and enterprise syscope apk I get this: Scanning... l'd Put up a pic, but it won't let me.
Sent from my SPH-L900 using xda premium
Click to expand...
Click to collapse
Interesting...more stuff to rip out! The pile is getting bigger by the minute

From a simple Google search sysscope determines if your phones moddifed and make some Samsung accessories not work with the phone...
Sent from my Galaxy Nexus using Tapatalk 2

Wordlywisewiz said:
Carrier IQ anyone? As for the second one it could be for warranty voiding if you root..but I'm no expert
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Now, thankfully I haven't found any CarrierIQ stuff.
The connection manager stuff is interesting, actually a pretty good idea for dumb/lazy people. I defrosted it and let it run for a bit. That sucker has logged every single access point my phone has seen. It put them in geographic groups and marked when it last saw them and even marked the ones that were wide open.
Logged the amount of data I used and why I dropped from the access point. Data sessions with amounts of the various access points I connected to.
The individual tower sector IDs along with the access point I was connected to. I assume so later the connection manager can learn where I used WiFi and attempt to use it again in those same areas. Kinda creepy it logs all of it, but it's really public info anyways if you drove around and logged the SSIDs anyways.
Kinda cool and I could see the benefit of it off loading data from the network. But something I don't need on my phone as I can handle my wifi connections myself.

Wordlywisewiz said:
From a simple Google search sysscope determines if your phones moddifed and make some Samsung accessories not work with the phone...
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
That must be why all share doesn't work on roms
sent from my awesomely huge Note II

fryingpan0613 said:
That must be why all share doesn't work on roms
sent from my awesomely huge Note II
Click to expand...
Click to collapse
It should be possible with a modified syscope apk just change a vqlue
Sent from my Galaxy Nexus using Tapatalk 2

Wordlywisewiz said:
It should be possible with a modified syscope apk just change a vqlue
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Yep. The Connection Manager one would be easy. just change it to Duperuser.apk

Related

[REQ] Need some info on MDIs in Smart device applications using C#.net

Hi all guys
i am new to C# and .net stuff as i was working with C++ for many years
i want to know that is it possibhle that i can have an MDI Child Form on my main Form and want it to return me some data
like for example i have my main Form has a "settings" button
when i click on "settings" button it should show a small MDI child form which has all the settings and return some data (i'll take care of data but i dont know how to return through a form)
thnx in advance
Well...as far as 'returning' data from the Form, you can't do that as a "return" call because Forms are objects, so the constructor cannot have a return type, however you can have a method that will set a variable in another class (that is public) to the data you want to return ... You can call this method when the form is closing.
I am not entirely sure if you can achieve the 'small form INSIDE another form' without creating your own control. I am not sure how practical/possible this would be, but you can try 1 of the following: extend the Control class (to make a control) or override the OnPaint of a new Form. This way you can define where stuff goes, and what gets drawn onto the screen.
I have used this piece of code in the past, which worked great.
in my example frmA was an MDIchildform of the main (MDIparent)
frmA()
{
public int a=0;
private btn_click(blabla)
{
frmOptions options = new frmOptions(this);
dialog.ShowDialog();
if(dialog.DialogResult == DialogResult.Yes)
{
dosomethingwith(a);
}
else
{
donothingwith(a);
}
}
}
public partial class frmOptions : Form
{
frmA callingform = null;
public frmOptions(frmA x)
{
callingform = x;
}
private void dosomething()
{
callingform.a = value;
}
private void btnSaveSettings_click()
{
this.DialogResult = DialogResult.Yes;
}
private void btnCancelSettings_click()
{
this.DialogResult = DialogResult.No;
}
}
good luck

[DEV] trying to port 2-way record to CM7/9

For the begging,
I found out that the problem for 2-way is on the libaudio.so, than I downloaded the source code from the github of samsung aries.
I found the file AudioHardware.cpp as the main one.
I googled the web and found a same file with 2-way and there is the code which do that
Code:
//wxj add for voice recorder
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <poll.h>
//wxj add end
Code:
//-------------- wxj add for voice recorder ----------------
#if RECORDER_MOMEM
/*
AT^DAUDREC=<ON/OFF>
<ON/OFF> 0 turn off record
1 turn on record
*/
#define MODEM_RECORD_INCALL_ON "at+audr=1\r"
#define MODEM_RECORD_INCALL_OFF "at+audr=0\r"
//define pty device for send at command
#define AUDIO_AT_PATH "/dev/ttymux4"
#define AUDIO_DATA_PATH "/dev/ttymux4"
#define NUM_ELEMS(a) (sizeof (a) / sizeof (a)[0])
static const char * s_finalResponsesError[] = {
"ERROR",
"+CMS ERROR:",
"+CME ERROR:",
};
/**
* returns 1 if line is a final response indicating success
* See 27.007 annex B
* WARNING: NO CARRIER and others are sometimes unsolicited
*/
static const char * s_finalResponsesSuccess[] = {
"OK",
};
static Mutex audioLockMutex;
static int isFinalResponseError(const char *line)
{
size_t i;
for (i = 0 ; i < NUM_ELEMS(s_finalResponsesError) ; i++) {
if (strcasestr(line, s_finalResponsesError[i])) {
return 1;
}
}
return 0;
}
static int isFinalResponseSuccess(const char *line)
{
size_t i;
for (i = 0 ; i < NUM_ELEMS(s_finalResponsesSuccess) ; i++) {
if (strcasestr(line, s_finalResponsesSuccess[i])) {
return 1;
}
}
return 0;
}
/**
* returns 1 if line is a final response, either error or success
* See 27.007 annex B
* WARNING: NO CARRIER and others are sometimes unsolicited
*/
static int isFinalResponse(const char *line)
{
return isFinalResponseSuccess(line) || isFinalResponseError(line);
}
static int s_fd = -1;
static int WriteATCommand(const char *s)
{
AutoMutex lock(audioLockMutex);
//int s_fd = open(AUDIO_AT_PATH,O_RDWR | O_NONBLOCK);
if ( s_fd < 0 ) {
LOGE(" AudioHardware ERROR OPEN AT interface, errno = %d ,s_fd = %d",errno,s_fd);
return -3;
}
size_t cur = 0;
size_t len = strlen(s);
ssize_t written;
LOGV(" AudioHardware AT> %s\n", s);
/* the main string */
while (cur < len) {
do {
written = write (s_fd, s + cur, len - cur);
} while (written < 0 && errno == EINTR);
if (written < 0) {
LOGE("AudioHardware write str error, errno = %d ",errno);
close(s_fd);
s_fd = 0;
return -1;
}
cur += written;
}
#if 0
/* the \r */
do {
written = write (s_fd, "\r" , 1);
} while ((written < 0 && errno == EINTR));
if (written < 0) {
LOGE(" AudioHardware write r error, errno = %d ",errno);
close(s_fd);
s_fd = 0;
return -1;
}
#endif
const int buf_len = 1024;
int readLen = 0, count = 0;
char* buffer = new char[buf_len];
//buffer[0] = '\0';
memset((void*)buffer, 0, buf_len);
bool final = false;
int tryTimes = 0;
int pollResult = 0;
for(;;){
while (0 == pollResult){
struct pollfd fpolls;
fpolls.fd = s_fd;
fpolls.events = POLLIN;
fpolls.revents = 0;
pollResult = poll(&fpolls, 1, 1000); //timeout 5 seconds
//data ready to be read
if (pollResult > 0 && POLLIN == fpolls.revents ){
LOGD(" AudioHardware data is available %d \n",__LINE__);
break;
}else if (pollResult < 0){
LOGD(" AudioHardware pollResult < 0 %d \n",__LINE__);
if (errno == EINTR){
continue;
}else{
break;
}
}else{
LOGE("timeout, but no data available");
if (tryTimes < 5){
tryTimes++;
}else{
LOGE("timeout, exit this command ");
delete []buffer;
close(s_fd);
s_fd = 0;
return -1;
}
}
}
do {
readLen = read (s_fd, buffer + count, buf_len - count);
} while ((readLen < 0 && errno == EINTR));
if (readLen > 0){
count += readLen;
}
if (isFinalResponse(buffer)){
final = true;
LOGD("at result=%s", buffer);
break;
}
tryTimes++;
if (tryTimes > 5){
break;
}
}
LOGV("AudioHardware AT>%s sucess", s);
delete []buffer;
//close(s_fd);
return 0;
}
#endif
//----------------- wxj add end for voice recorder -----------
I don't have linux or other way to compile the files, and I wish someone with more experience from me will compile it and I'm sure we will fine volunteers to test that.
the full cpp files are attached.
By the way, the lib file will be good even to the other ICS roms which based on samsung aries of CM
would be really cool to have that possibilty in more roms, so thx to come up with that and hopefully some dev has the time and knowledge to do this...
sry that i can't help you myself!
greetz,
sUsH
What model does this AudioHardware relate to? If this is related to MSMxxxx audio hardware, probably this will not work in any way. DEAR DEVELOPERS, can you help to continue this work to finally implement this feature? I think that we can start collecting dotations in order to make everybody involved in this project!!
I wish good luck and say THANKS to OP and all people who is able to help in any way!! I hope that this project will not stop and finally we add this so useful feature to our beloving Galaxy.
I'm afraid it does belong to msm, but even if not, there must be a way based on that, for just changing the code.
I can't find the source again but I think it was belong to defy
it IS definitely possible on our sgs, cause i remember some miui-rom i once flashed and used for a while, and with this rom two-way-call-recording was possible, meaning while in call i could just press the record-button and the call (both the caller and me) got recorded.
don't know if it was some dirty hack but it worked, i recorded plenty of calls with this rom. even automatic call recording was possible, so that everytime i got a call, it got recorded automagically.
if this is of interest, i could search for that specific miui-rom in my rom-archive.
greetz,
sUsH
sUsH667 said:
it IS definitely possible on our sgs, cause i remember some miui-rom i once flashed and used for a while, and with this rom two-way-call-recording was possible, meaning while in call i could just press the record-button and the call (both the caller and me) got recorded.
don't know if it was some dirty hack but it worked, i recorded plenty of calls with this rom. even automatic call recording was possible, so that everytime i got a call, it got recorded automagically.
if this is of interest, i could search for that specific miui-rom in my rom-archive.
greetz,
sUsH
Click to expand...
Click to collapse
Afaik, 2 way recording wasn't implemented on cm7/miui like ever. It was illegal and a dirty hack to.
Sent from my GT-I9000 using xda premium
siky_dude said:
It was illegal and a dirty hack to.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
But remember that not in every country...
hmm, are you sure? i really have that in my mind.
well, i'll look through my rom-history and see which one i think it was, maybe i am wrong...
Rausio said:
But remember that not in every country...
Click to expand...
Click to collapse
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
siky_dude said:
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
it is legal in every country... the issue in USA is that the recorder partner should tell the other side that the conversation is recorded, for example in Israel, just one side should know that the conversation is under recording, to prevent illegal bugging.
and it's not creepy we should record conversation for a lot of reason, even for people who are on ways all time and want to remember the conversation issue, or even when we argument with the cellular/internet providers.
It was working fine on froyo:
http://forum.xda-developers.com/showthread.php?t=967297
And stayed as project on gingerbread:
http://forum.xda-developers.com/showthread.php?t=1089425
Guys, let's stop offtopic discussing how legal is call recording or not, and also is it useful feature or useless; it is being discussed in other threads many times.
And the project on gingerbread trying to modify existing libraries probably ended with no success after trying all possible things, so we have to follow this way meaning developing the missing code, and i think now it is the only right way.
P.S. Probably this code also relates to call recording:
Code:
#if RECORDER_MOMEM
if(devices == AudioSystem::DEVICE_IN_VOICE_CALL) {
LOGV("set begin recording voice ");
mDevices = devices;
mVoiceRecorderFD = ::open(AUDIO_DATA_PATH,O_RDWR | O_NONBLOCK);
int i = 0;
while(mVoiceRecorderFD < 0) {
i++;
LOGV("AudioStreamInALSA::set i = %d ",i);
usleep(5000);
mVoiceRecorderFD = ::open(AUDIO_DATA_PATH,O_RDWR | O_NONBLOCK);
if(i > 20) {
LOGE(" AudioStreamInALSA::setDevice open muxaudio failure ",i);
return NO_INIT;
}
}
s_fd = mVoiceRecorderFD;
WriteATCommand(MODEM_RECORD_INCALL_ON);
return NO_ERROR;
}
#endif
l2tp, the code you brought here, seems to be related to ALSA (our galaxy) and is not related to the one I brought.
It's seems to be better chance.
Hey guys, did anybody try to do something on this?
Let's not give up!
siky_dude said:
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
Disabling camera shutter sound is also illegal for some countries. But you can disable it on Cyanogenmod settings. It just warns you about legality.
I have the coding skills but not the time to fully do this. I just thought I'd post and offer to assist if anyone wants to lead the project.
Plz do not give up!!
l2tp said:
Hey guys, did anybody try to do something on this?
Let's not give up!
Click to expand...
Click to collapse
I have also been waiting for this ever since I lost the feature after moving from Froyo to GB. :crying: It was a wonderful feature which eradicated the need for keeping a pen and paper ready for long office conference calls, specially when on the road. I was using some automatic recording script with customizable file naming convention and was in bliss!
In terms of legality, please let's keep that out of the equation as already pointed out with the camera shutter analogy. :silly:
The way I saw it, the legality thing was brought into picture by the MIUI 'porting' teams after the Froyo -> GB upgrade and instead of trying to 'fix' it, the questionable legality argument got presented.
Frankly, since the hardware supports it, it is only a question of finding and tweaking the correct sources. I do not have access to a compiler at the moment, but if someone needs help with code-reading/ review, please continue posting here or on pastebin. :fingers-crossed:
+1 this would be awesome!
2 way call recording is very important for me. Still using Darky 9.5 (Froyo) because of that, but I would like to try a GB or ICS ROM if a patch was available.

Advice on strategy

I'm developing a WP7 app, working alongside a Windows (server) application. They are talking with each other using sockets.
As soon as the WP7 app opens, I wish to perform a network scan to find the server application.
I already found out how to get the IP address of the WP7. So let's say I know the server should be somewhere at 192.168.0.*. How do I go about scanning this network?
I tried many things, the last of which is the code below. The problem here is that somehow the TIMEOUT_MILLISECONDS parameter seems to be like playing roulette (tried everything in the range of 100-2000 with different success). In addition, if I sweep the whole subnet like in the code below the phone cannot seem to handle the work. I only get it to work if I set the timeout to 2000 (which is way to long) and by scanning up to 5 IP's in the for-loop, instead of the whole subnet.
Is there anyone that knows a better and much more efficient(!) way to do this?
Code:
string thisIP = "192.168.0.101"; // I normally get this from some other function
string[] arrIP = thisIP.ToString().Split('.');
string IPBase = arrIP[0] + "." + arrIP[1] + "." + arrIP[2] + ".";
//MessageBox.Show(address.ToString());
for (int i = 2; i < 254; i++) {
string IP = IPBase + i;
CheckConnection CheckConn = new CheckConnection();
string resultConnect = CheckConn.Connect(IP, int.Parse(Resource1.port));
if (resultConnect == "Success") {
CheckConn.Send("isAlive");
string result = CheckConn.Receive();
if (result.Contains("yes")) {
// We have found the server
break;
}
}
CheckConn.Close();
}
Code:
public class CheckConnection
{
// Cached Socket object that will be used by each call for the lifetime of this class
Socket _socket = null;
static ManualResetEvent _clientDone = new ManualResetEvent(false);
const int TIMEOUT_MILLISECONDS = 100;
const int MAX_BUFFER_SIZE = 2048;
public string Connect(string hostName, int portNumber) {
string result = string.Empty;
DnsEndPoint hostEntry = new DnsEndPoint(hostName, portNumber);
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = hostEntry;
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
result = e.SocketError.ToString();
_clientDone.Set();
});
_clientDone.Reset();
_socket.ConnectAsync(socketEventArg);
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
return result;
}
public string Send(string data) {
string response = "Operation Timeout";
if (_socket != null) {
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
socketEventArg.UserToken = null;
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
response = e.SocketError.ToString();
_clientDone.Set();
});
byte[] payload = Encoding.UTF8.GetBytes(data);
socketEventArg.SetBuffer(payload, 0, payload.Length);
_clientDone.Reset();
_socket.SendAsync(socketEventArg);
// Block the UI thread for a maximum of TIMEOUT_MILLISECONDS seconds.
// If no response comes back within this time then proceed
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
}
else {
response = "Socket is not initialized";
}
return response;
}
public string Receive() {
string response = "Operation Timeout";
if (_socket != null) {
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
socketEventArg.SetBuffer(new Byte[MAX_BUFFER_SIZE], 0, MAX_BUFFER_SIZE);
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
if (e.SocketError == SocketError.Success) {
response = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred);
response = response.Trim('\0');
}
else {
response = e.SocketError.ToString();
}
_clientDone.Set();
});
_clientDone.Reset();
_socket.ReceiveAsync(socketEventArg);
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
}
else {
response = "Socket is not initialized";
}
return response;
}
public void Close() {
if (_socket != null) {
_socket.Close();
}
}
}
Why you don't know the server IP?
I can't help you with your subnet scanning problem, don't have experience with that corner of WP7 programming.
But I do wonder what kind of arrangement leads to the problem that your app does not know the server address and therefore has to scan for it. Is neither a fixed IP available for your server nor some kind of DNS service up to tell you the current IP?
Even if there are multiple servers running and the phone has the job to somehow decide which one of those is responsible for it, you still could set up some kind of super-server that the phones could ask first which server they should address.
In any way, phones scanning subnets to find servers as some routine app startup action is a bad idea, if you ask me.
Please note that by 'server' I'm just revering to a software that accepts socket connections. This software is installed into a Windows computer that most likely has it's IP from DHCP.
The server software itself could present it's IP address so the end-user can type this address into the client on their WP7. Nice for tech-savvy folks, but that's not how software should be designed in my opinion. People don't need to know what an IP address is and shouldn't be force into typing 'weird numbers'. Properly designed software just have to work instantly and developers (again in my opinion) need to take care of a good design and that includes making things plug-and-play where they can.
Take a look at 'PC Remote' and you will see the kind of easy plug-and-play experience I'm looking for.
Did you check broadcast?
I'm really not network guy, but from Googling I got the impression that people use broadcast instead of IP range scanning for such IP number discovery tasks, and there seems to be a way to do broadcast on WP7 (albeit only using some tricks / hardly documented functionalilty):
E.g. see this thread:
http://stackoverflow.com/questions/8533471/udp-broadcasting-in-windows-phone-7
Which links to this:
http://forums.create.msdn.com/forums/t/88975.aspx
This makes sense to me after reading that broadcast is also the method how a client finds its DHCP server - isn't that the exact same scenario like yours?
Did you already check this way of looking at the problem, or maybe rule it out already for some reason?
It's better if you use a multicast group to send/receive packages. I had way better experience with it than using the Broadcast IP.
You need to join the multicast group with the phone and with the server app. I know there are multicast classes but I found it easier and mor convient to implement it with a socket...
And after you found the server, I'd use a persistent tcp connection which should improve your network performance (udp and wp7 is sometimes really strange...)
Thanks rbrunner7 and chabun for your comments, I appreciate your input!
rbrunner7 said:
Did you already check this way of looking at the problem, or maybe rule it out already for some reason?
Click to expand...
Click to collapse
I did, briefly, but abandoned this path after reading about the physical network equipment (switches etc.) having the need to support broadcasting which might not always be the case.
Anyway, your mentioned post describes 'limited broadcasting', which might be exactly what I should be looking for. Hopefully hardware limitations will not be applicable; I will look into this method further and will let you know how it works out!
roady001 said:
the physical network equipment (switches etc.) having the need to support broadcasting which might not always be the case.
Click to expand...
Click to collapse
I had the same doubts about that as it's also the case for multicasting. Most modern equipement supports it though and you can always provide the possibility to manually enter the server ip if you can't discover one via multicast/broadcast

[Technical Guide] Hide tethering on H830

I am not going to provide a pre-built apk.
If you want to hide tethering, you have to learn and know the basics of xposed and compiling an apk.
I would prefer that no one provides a pre-built APK either, but I obviously can't demand/enforce this
Requirements: H830 T-mobile LG G5, root, xposed
May or may not work with other LG G5 variants
Technical details:
Tethering app verifies permission with T-mobile before starting
When you enable tethering, there is a popup saying something like "Please wait, verifing...".
The "whichurl" backdoor bypasses this check/popup.​
Tethered data gets diverted into separate tethering APN
T-mobile monitors this separate APN. The initZygote stuff attempts to stop this from happening. I have not tested this throughly, but it seems to work​
Rest of the hooks, probably not important
Code
Code:
package com.xposed.lgg5.tethering;
import android.content.Context;
import android.content.res.XResources;
import android.util.Log;
import android.widget.Toast;
import de.robv.android.xposed.*;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import static de.robv.android.xposed.XposedHelpers.setIntField;
public class XposedTetheringH830 implements IXposedHookLoadPackage, IXposedHookZygoteInit{
public void initZygote(IXposedHookZygoteInit.StartupParam var1) throws Throwable {
Log.i("XposedTetheringH830", "Updating systemwide arrays to stop tethering data being diverted into tethering APNs");
XResources.setSystemWideReplacement("android", "array", "config_mobile_hotspot_provision_app", new String[0]);
// If we override the three items below, tethering is completely disabled on device
/*XResources.setSystemWideReplacement("android", "array", "config_tether_usb_regexs", new String[0]);
XResources.setSystemWideReplacement("android", "array", "config_tether_wifi_regexs", new String[0]);
XResources.setSystemWideReplacement("android", "array", "config_tether_bluetooth_regexs", new String[0]);*/
// don't know if this is necessary
XResources.setSystemWideReplacement("android", "array", "config_tether_upstream_types", new int[0]);
// necessary, otherwise phone diverts tethered data into separate APNs
XResources.setSystemWideReplacement("android", "array", "config_tether_apndata", new String[0]);
}
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if(lpparam.packageName == null || lpparam.appInfo == null || lpparam.appInfo.packageName == null) {
return;
}
if(lpparam.packageName.equals("com.lge.upsell")) {
// stops tethering APK from checking with Tmobile on tethering permissions on your account
findAndHookMethod("com.lge.upsell.UpsellUtil", lpparam.classLoader, "getSettingInt", Context.class, String.class, int.class,
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Context context = (Context) param.args[0];
if (param.args[1].equals("whichurl")) {
Toast.makeText(context, "Upsell whichurl override = 4", Toast.LENGTH_SHORT).show();
Log.i("XposedTetheringH830", "Nice LG backdoor, Upsell whichurl override = 4");
param.setResult(4);
}
}
}
);
}
// rest of these hooks probably not needed... the whichurl backdoor above is most important
if(lpparam.packageName.equals("com.lge.wifihotspotwidget")) {
findAndHookMethod("com.lge.wifihotspotwidget.MDMWifiSettingsAdapter", lpparam.classLoader, "checkDisallowHotspot", new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
Log.i("XposedTetheringH830", "checkDisallowHotspot = false");
return false;
}
});
findAndHookMethod("com.lge.wifihotspotwidget.WidgetPopup", lpparam.classLoader, "isTmusSimCard", new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
Log.i("XposedTetheringH830", "widgetPopup isTmusSimCard = false");
return false;
}
});
findAndHookMethod("com.lge.wifihotspotwidget.HotspotWidgetProvider", lpparam.classLoader, "isTmusSimCard", new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
Log.i("XposedTetheringH830", "HotspotWidgetProvider isTmusSimCard = false");
return false;
}
});
findAndHookMethod("android.os.UserManager", lpparam.classLoader, "hasUserRestriction", String.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if(param.args[0].equals("no_config_tethering")){
Log.i("XposedTetheringH830", "no_config_tethering = false");
param.setResult(false);
}
}
});
}
}
}
Thank you for the info; however, why can't you provide an apk? It would be great if you could. ?
I'd like to do it but don't have a clue.
Sent from my LG-H830 using XDA-Developers mobile app
Yes? No? Please?
Sent from my LG-H830 using XDA-Developers mobile app
Does this mean this tethers without using data from tethering?
Sent from my LG-H830 using Tapatalk
gamepr said:
Yes? No? Please?
Sent from my LG-H830 using XDA-Developers mobile app
Click to expand...
Click to collapse
He literally just said he won't do it and doesn't want others to do it either. If someone does it then i guess it's fine but do not flat out disregard the OP's request by asking him to do it for you.
I am grateful to the OP for detailing what needs to be in an apk. I don't have the know how either to build this but I'm sure there are many that do.
Sent from my LG-H830 using XDA-Developers mobile app
arjuna_ said:
He literally just said he won't do it and doesn't want others to do it either. If someone does it then i guess it's fine but do not flat out disregard the OP's request by asking him to do it for you.
I am grateful to the OP for detailing what needs to be in an apk. I don't have the know how either to build this but I'm sure there are many that do.
Sent from my LG-H830 using XDA-Developers mobile app
Click to expand...
Click to collapse
Arjuna,
You are not bringing anything to the table as far as this subject is concerned. The op stated that he will not provide a pre built apk and that he prefers no one doing so either. I help out forum members as much as I can and encourage others to do so as well.
The op opposes a pre built apk..... I'm trying to encourage him to provide a compiled apk (not a pre built one) so that other members, like me and you, can benefit from a tethering "mask" mod/patch.
Encouraging him to compile such mod/patch for all of us is not unreasonable; moreover, I am not asking him to do anything illegal. We are all part of this community. We collaborate and help each other out whether it's through technical data collaboration, offering personal phone reviews, or answering questions.
I regret to inform you that your personal interpretation is not helping the cause. I have to constantly take my Sim card out of the LG g5 and into the nexus 5 to tether.
Sent from my LG-H830 using XDA-Developers mobile app
There is literally no difference between a pre-built apk and a compiled apk. They're synonymous with each other. I think the only warped interpretation here is your expectations of what this site offers. This is a community that promotes the combined effort towards the developmental aspect of android, where you can share your progress on projects, get technical insight on how to overcome whatever obstacles youre facing, but most importantly find all the guides and documentation you need to teach YOURSELF, not to demand others share their personal work with you. If you're simply looking to swap apps with other users, there are a plethora of file sharing websites out there, but if you want to actually contribute to this community, crack a book or go read a guide.
I successfully created an Xposed module that was installed with the Android Studio. However I can't get it to function in the manner it is supposed to: blocking the tethering usage statistics. I don't know how I go about debugging it to make sure I did it correctly. If you can PM to take a look at what I did and where I can improve it that would be very beneficial. This was quite an interesting endeavor for me honestly and I feel like I learned a tiny bit of what it is like to be a developer.
Make sure you aren't trying to tether to a Windows computer, T-Mobile can still track that.
Sent from my SM-T320 using Tapatalk
DualSportDad said:
Make sure you aren't trying to tether to a Windows computer, T-Mobile can still track that.
Sent from my SM-T320 using Tapatalk
Click to expand...
Click to collapse
I'm assuming they couldn't track it if you use a VPN, right?
P.S. I wonder how convoluted a personal connection can get. A laptop tethered to a mobile device feeding a connection through a VPN is starting to seem pretty up there. Add in a proxy through TOR and you are probably maxing out your ridiculosity.
Has anyone had success with this? I will gladly buy an APK off of somebody haha, name your price (within reason). Apologies if this irks you OP.

Get Device Id used by an App

Hi,
I'm trying to hack an old game (it isn't available in the store anymore) for fun and learning purposes. I'm running W10 but the app is targeted for WP7.
The game encrypts all the files it saves with AES, using the Device Unique Id as the key. It gets the DUID with the following code:
Code:
private string DeviceId
{
get
{
if (string.IsNullOrEmpty(this.id))
{
byte[] numArray = (byte[]) DeviceExtendedProperties.GetValue("DeviceUniqueId");
this.id = "";
foreach (byte num in numArray)
this.id += num.ToString("X2");
if (string.IsNullOrEmpty(this.id))
this.id = "0D0FC36982524EBB25E1CA471F32824286B90F47";
}
return this.id;
}
}
The thing is I don't know how to get that ID from outside the app, which might be unique for the device and publisher. I've searched in all the app files in AppData and seems like it doesn't record the ID anywhere.
I've tried for days and considered other approaches with no luck. Ideas? Suggestions? Any help? Thanks.

Categories

Resources