Skip to content

Commit

Permalink
7.28 auto-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rev1si0n committed Jan 14, 2024
1 parent cff5b3d commit 6a4a26c
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 176 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
7.28
* 新增 show_toast 接口
* 内置代理现已支持代理 DNS 流量
* startmitm 现已支持 DNS 通过上游代理
* 修复安卓 10+ frida spwan

7.25
* 修复定时任务运行失败的问题
* 修复从 termux 启动失败的问题
Expand Down
2 changes: 1 addition & 1 deletion lamda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# Distributed under MIT license.
# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
__version__ = "7.25"
__version__ = "7.28"
17 changes: 14 additions & 3 deletions lamda/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@
from . exceptions import UnHandledException, DuplicateEntryError, InvalidArgumentError
from . import exceptions

handler = logging.StreamHandler()
logger = logging.getLogger("lamda.client")
FORMAT = "%(asctime)s %(process)d %(levelname)7s@%(module)s:%(funcName)s - %(message)s"
formatter = logging.Formatter("%(asctime)s %(process)d %(levelname)7s@%(module)s:%(funcName)s - %(message)s")
handler.setFormatter(formatter)
logger.addHandler(handler)

sys.path.append(joinpath(dirname(__file__)))
sys.path.append(joinpath(dirname(__file__), "rpc"))
Expand Down Expand Up @@ -183,6 +186,7 @@ def corner(b, position):
OpenVPNKeyDirection = protos.OpenVPNKeyDirection
OpenVPNCipher = protos.OpenVPNCipher
OpenVPNProto = protos.OpenVPNProto
ToastDuration = protos.ToastDuration
Orientation = protos.Orientation

# proxy request alias
Expand Down Expand Up @@ -1269,6 +1273,13 @@ def beep(self):
"""
r = self.stub.beepBeep(protos.Empty())
return r.value
def show_toast(self, text, duration=ToastDuration.TD_SHORT):
"""
在系统界面底部显示一个 Toast 消息
"""
req = protos.ShowToastRequest(text=text, duration=duration)
r = self.stub.showToast(req)
return r.value
def setprop(self, name, value):
"""
设置系统属性(aka: setprop,支持设置 ro.xx 只读属性)
Expand Down Expand Up @@ -1888,6 +1899,8 @@ def record_touch(self):
return self.stub("Util").record_touch()
def perform_touch(self, sequence, wait=True):
return self.stub("Util").perform_touch(sequence, wait=wait)
def show_toast(self, text, duration=ToastDuration.TD_SHORT):
return self.stub("Util").show_toast(text, duration=duration)
def is_ca_certificate_installed(self, certdata):
return self.stub("Util").is_ca_certificate_installed(certdata)
def uninstall_ca_certificate(self, certfile):
Expand Down Expand Up @@ -2022,8 +2035,6 @@ def device_info(self):
def __call__(self, **kwargs):
return self.stub("UiAutomator")(**kwargs)
# 日志打印
def setup_log_format(self):
logging.basicConfig(format=FORMAT)
def set_debug_log_enabled(self, enable):
level = logging.DEBUG if enable else logging.WARN
logger.setLevel(level)
Expand Down
84 changes: 42 additions & 42 deletions lamda/rpc/application.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,70 @@ enum GrantType {
}

message ApplicationRequest {
string name = 1;
string permission = 2;
GrantType mode = 3;
string path = 4;
string name = 1;
string permission = 2;
GrantType mode = 3;
string path = 4;
}

message ApplicationActivityRequest {
string package = 1;
string action = 2;
string category = 3;
string component = 4;
google.protobuf.Struct extras = 5;
repeated string categories = 6;
int64 flags = 7;
bool debug = 8;
string data = 9;
string package = 1;
string action = 2;
string category = 3;
string component = 4;
google.protobuf.Struct extras = 5;
repeated string categories = 6;
int64 flags = 7;
bool debug = 8;
string data = 9;
}

message ApplicationActivityInfo {
string package = 1;
string action = 2;
string category = 3;
string component = 4;
google.protobuf.Struct extras = 5;
repeated string categories = 6;
int64 flags = 7;
bool debug = 8;
string data = 9;
string package = 1;
string action = 2;
string category = 3;
string component = 4;
google.protobuf.Struct extras = 5;
repeated string categories = 6;
int64 flags = 7;
bool debug = 8;
string data = 9;
}

message ApplicationActivityInfoList {
repeated ApplicationActivityInfo activities = 1;
repeated ApplicationActivityInfo activities = 1;
}

message ApplicationPermissions {
repeated string permissions = 1;
repeated string permissions = 1;
}

message ApplicationInfo {
string packageName = 1;
uint32 uid = 2;
bool enabled = 3;
string processName = 4;
string sourceDir = 5;
string dataDir = 6;
uint32 baseRevisionCode = 7;
int64 firstInstallTime = 8;
int64 lastUpdateTime = 9;
uint32 versionCode = 10;
string versionName = 11;
string activity = 12;
string packageName = 1;
uint32 uid = 2;
bool enabled = 3;
string processName = 4;
string sourceDir = 5;
string dataDir = 6;
uint32 baseRevisionCode = 7;
int64 firstInstallTime = 8;
int64 lastUpdateTime = 9;
uint32 versionCode = 10;
string versionName = 11;
string activity = 12;
}

message ApplicationProcess {
repeated string packages = 1;
string processName = 2;
int64 uid = 3;
int64 pid = 4;
repeated string packages = 1;
string processName = 2;
int64 uid = 3;
int64 pid = 4;
}

message ApplicationProcesses {
repeated ApplicationProcess processes = 1;
repeated ApplicationProcess processes = 1;
}

message ApplicationPkgNames {
repeated string names = 1;
repeated string names = 1;
}
8 changes: 4 additions & 4 deletions lamda/rpc/policy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ syntax = "proto3";
package lamda.rpc;

message SelinuxPolicyRequest {
string source = 1;
string target = 2;
string tclass = 3;
string action = 4;
string source = 1;
string target = 2;
string tclass = 3;
string action = 4;
}
49 changes: 25 additions & 24 deletions lamda/rpc/proxy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ enum GproxyType {
}

message GproxyConfigRequest {
ApplicationInfo application = 1;
GproxyType type = 2;
string nameserver = 3;
string login = 4;
string password = 5;
string host = 6;
uint32 port = 7;
bool bypass_local_subnet = 8;
bool drop_udp = 9;
bool udp_proxy = 10;
ApplicationInfo application = 1;
GproxyType type = 2;
string nameserver = 3;
string login = 4;
string password = 5;
string host = 6;
uint32 port = 7;
bool bypass_local_subnet = 8;
bool drop_udp = 9;
bool udp_proxy = 10;
bool dns_proxy = 11;
}

enum OpenVPNProto {
Expand Down Expand Up @@ -70,18 +71,18 @@ enum OpenVPNEncryption {
}

message OpenVPNConfigRequest {
bool all_traffic = 1;
OpenVPNProto proto = 2;
string host = 3;
uint32 port = 4;
OpenVPNCipher cipher = 5;
string ca = 6;
string cert = 7;
string key = 8;
OpenVPNEncryption tls_encryption = 9;
OpenVPNKeyDirection tls_key_direction = 10;
string tls_key = 11;
OpenVPNAuth auth = 12;
string login = 13;
string password = 14;
bool all_traffic = 1;
OpenVPNProto proto = 2;
string host = 3;
uint32 port = 4;
OpenVPNCipher cipher = 5;
string ca = 6;
string cert = 7;
string key = 8;
OpenVPNEncryption tls_encryption = 9;
OpenVPNKeyDirection tls_key_direction = 10;
string tls_key = 11;
OpenVPNAuth auth = 12;
string login = 13;
string password = 14;
}
1 change: 1 addition & 0 deletions lamda/rpc/services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ service Util {
rpc installCACertificate(CertifiRequest) returns (Boolean) {}
rpc uninstallCACertificate(CertifiRequest) returns (Boolean) {}
rpc shutdown(google.protobuf.Empty) returns (Boolean) {}
rpc showToast(ShowToastRequest) returns (Boolean) {}
rpc reload(Boolean) returns (Boolean) {}
rpc exit(google.protobuf.Empty) returns (Boolean) {}
rpc setProp(SetPropRequest) returns (Boolean) {}
Expand Down
6 changes: 3 additions & 3 deletions lamda/rpc/settings.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum Group {
}

message SettingsRequest {
Group group = 1;
string name = 2;
string value = 3;
Group group = 1;
string name = 2;
string value = 3;
}
20 changes: 10 additions & 10 deletions lamda/rpc/shell.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ syntax = "proto3";
package lamda.rpc;

message ShellRequest {
string tid = 1;
string name = 2;
string script = 3;
int32 timeout = 4;
string tid = 1;
string name = 2;
string script = 3;
int32 timeout = 4;
}

message ShellResult {
int32 exitstatus = 1;
bytes stdout = 2;
bytes stderr = 3;
int32 exitstatus = 1;
bytes stdout = 2;
bytes stderr = 3;
}

message ShellTask {
string tid = 1;
string name = 2;
int32 pid = 3;
string tid = 1;
string name = 2;
int32 pid = 3;
}
Loading

0 comments on commit 6a4a26c

Please sign in to comment.