clburlison / dmon Goto Github PK
View Code? Open in Web Editor NEWiOS jailbreak monitoring & update solution
License: MIT License
iOS jailbreak monitoring & update solution
License: MIT License
Sending telemetric data to DCM (or any other backend) could provide better traceability of random device reboots etc.
If desired, i can make a backend that can retrieve that data and generate graphs for each device and parameter.
int sendTelemetricData (void)
{
// Device name
NSString *deviceName = [[UIDevice currentDevice] name];
// Battery percentage
UIDevice *device = [UIDevice currentDevice];
device.batteryMonitoringEnabled = YES;
float batteryLevel = [device batteryLevel] * 100.0f;
// CPU temperature
int mib[2];
mib[0] = CTL_HW;
mib[1] = HW_CPU_TEMPERATURE;
int64_t temperature;
size_t length = sizeof(temperature);
sysctl(mib, 2, &temperature, &length, NULL, 0);
float cpuTemp = temperature / 100.0f;
// Init
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, "http://YOUR_DCM_URL");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "device_name=%f&battery_percentage=%f&cpu_temperature=%f", [deviceName UTF8String], batteryLevel, cpuTemp);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
fprintf(stderr, "dmon: curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
}
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
Right now if the webserver doesn't have a valid path curl is still exiting with return code 0. Need to add some better error handling. Also make sure we don't save an empty file to disk.
I'd appreciate it if dmon also constantly reset the display brightness to 0. Some devices keep bugging me with that.
#import <UIKit/UIKit.h>
int dimDisplayBrightness (void)
{
@autoreleasepool
{
UIScreen *mainScreen = [UIScreen mainScreen];
mainScreen.brightness = 0.0f;
}
return 0;
}
The following method of detecting if Pokemon Go is running is flawed
Lines 3 to 8 in d873255
Even with the game closed the process can still be running. Didn't catch this edge case initially.
root# ps aux | grep -i "PokmonGO.app/PokmonGO" | grep -v grep
mobile 23398 0.0 0.2 408075872 3888 ?? Ss 11:45PM 0:00.50 /var/containers/Bundle/Application/42E6155C-F220-4682-9CBC-25ECAB5BD2DC/PokmonGO.app/PokmonGO
Initially I wanted to do game detection via the proper Apple API. But no matter what I try I always get null
as the output. Tried a few different varaiations in the following file to get [(SpringBoard *)UIApplication.sharedApplication _accessibilityFrontMostApplication];
to work but never got anything usable.
https://github.com/clburlison/dmon/blob/current_app/tools/current_app.m
Sometimes PoGo stops working even though it's opened and the frontmost app, so a better approach would be to check if PoGo is actually doing something. Those functions check the last log time of GC and then checks if it's more than 5 minutes in the past. We can further tweak that time frame in the future.
#include <asl.h>
#include <time.h>
int pogo_work_state(time_t log_time)
{
time_t current_time = time(NULL);
return (difftime(current_time, log_time) > 300);
}
time_t get_last_log_time()
{
aslclient client = asl_open(NULL, "com.gocheats.jb", 0);
aslmsg query = asl_new(ASL_TYPE_QUERY);
asl_set_query(query, ASL_KEY_SENDER, "com.gocheats.jb", ASL_QUERY_OP_EQUAL);
aslresponse response = asl_search(client, query);
aslmsg msg;
time_t last_time = 0;
while ((msg = aslresponse_next(response)) != NULL)
{
const char *time_str = asl_get(msg, ASL_KEY_TIME);
time_t time_val = (time_t)strtoll(time_str, NULL, 10);
if (time_val > last_time)
{
last_time = time_val;
}
}
aslresponse_free(response);
asl_free(query);
asl_close(client);
return last_time;
}
Just flat forgot. The LaunchD unload/reload is the only piece I'm a little concerned about. If dmon is subbing out to popen & the daemon is unloaded I'm not sure if the rest of the postinstall script will run.
Since GC already requires DCM it might make sense to have it host the packages.
If someone wants to work on this the version.txt file should likely stay the same format? Just have nodejs build the config map on get request. Also I'd like to make it optional so users can use basic web server or DCM.
I am not scheduled work for this. Resource limited at the moment but will accept a PR.
In order for substitute to properly install we need to apt update & apt upgrade
on the phone. Ideally we want this to occur silently but unsure if there are any supported CLI flags that will do this.
Lines 30 to 34 in d873255
If we can't get the following to work we should link the two correct .debs in the readme. The downside it they can't be easily updated via apt update
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.