shortx命令
1 subscriber
1 photo
1 file
5 links
Download Telegram
Forwarded from 星霜笔记
//判断热点状态
import android.content.Context;
import android.net.wifi.WifiManager;
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
return wifiManager.isWifiApEnabled();

//判断GPS状态
import android.location.LocationManager;
locationManager = context.getSystemService(context.LOCATION_SERVICE);
boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

//判断NFC状态
import android.nfc.NfcAdapter;
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter();
boolean isEnabled = nfcAdapter != null && nfcAdapter.isEnabled();
return isEnabled;

//数据状态
import android.content.Context;
import android.telephony.TelephonyManager;
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
boolean isDataEnabled = telephonyManager.getDataEnabled();

//蓝牙
import android.bluetooth.BluetoothAdapter;
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
boolean isBluetoothEnabled = bluetoothAdapter.isEnabled();

//WiFi状态
import android.content.Context;
import android.net.wifi.WifiManager;
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
boolean isWifiEnabled = wifiManager.isWifiEnabled();

//是否处于通话中
import android.content.Context;
import android.telephony.TelephonyManager;
telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
int callState = telephonyManager.getCallState();
return callState == TelephonyManager.CALL_STATE_OFFHOOK || callState == TelephonyManager.CALL_STATE_RINGING;

//获取飞行模式状态
import android.provider.Settings;
int airplaneMode = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0);
return airplaneMode == 1;

#mvel
Forwarded from 星霜笔记
//微信快捷启动(bizshortcut方式1)
am start "intent:#Intent;action=com.tencent.mm.action.BIZSHORTCUT;B.LauncherUI.From.Biz.Shortcut=true;S.LauncherUI.Shortcut.Username=wxid;end";

//微信聊天页面启动(带等待/重启,公众号)
am start -W -S -n com.tencent.mm/.ui.chatting.ChattingUI --es Chat_User gh_;

//微信聊天页面启动(指定模式,个人号)
am start -n com.tencent.mm/com.tencent.mm.ui.chatting.ChattingUI --ei Chat_Mode 1 --es Chat_User wxid;

//微信快捷启动(bizshortcut方式2,指定组件+启动旗标)
am start "intent:#Intent;action=com.tencent.mm.action.BIZSHORTCUT;launchFlags=0x10000000;component=com.tencent.mm.plugin.base.stub.WXEntryActivity;B.LauncherUI.From.Biz.Shortcut=true;S.LauncherUI.Shortcut.Username=wxid;end";

//微信聊天页面启动(带flags参数)
am start -n com.tencent.mm/.ui.chatting.ChattingUI --es Chat_User wxid -f 0x14000000;

#微信聊天页面启动 #shell
Forwarded from 星霜笔记
// 原低优先级类型(仅悬浮窗,受权限/层级限制)
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY

// 最高优先级类型:突破悬浮窗限制,可覆盖锁屏、状态栏、通知栏
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;

// 解除布局边界限制:允许视图延伸到状态栏/导航栏区域显示
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
Forwarded from 星霜笔记
import java.net.HttpURLConnection;
import java.net.URL;

// 创建一个URL对象,指向百度网站
URL url = new URL("https://baidu.com");

// 打开一个HTTP连接
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

// 设置HTTP请求方法为GET
connection.setRequestMethod("GET");

// 设置连接超时时间为1秒
connection.setReadTimeout(1000); // 1秒

// 获取HTTP响应码
int responseCode = connection.getResponseCode();

// 如果收到的状态码不是在400-499范围内,则输出网络连接正常
if (responseCode < 400 || responseCode >= 500) {
    ("网络连接正常");
}

#mvel
Forwarded from 星霜笔记
function isDeviceMoving(threshold, durationMs) {
    var Thread = java.lang.Thread;
    var context = android.app.ActivityThread.currentApplication().getApplicationContext();
    var sensorManager = context.getSystemService(android.content.Context.SENSOR_SERVICE);
    var gyroSensor = sensorManager.getDefaultSensor(android.hardware.Sensor.TYPE_GYROSCOPE);
    var motionDetected = false;
    var listener = new android.hardware.SensorEventListener({
        onSensorChanged: function(event) {
            var x = event.values[0];
            var y = event.values[1];
            var z = event.values[2];
            var magnitude = Math.sqrt(x*x + y*y + z*z);

            if(magnitude > threshold) {
                motionDetected = true;
            }
        },
        onAccuracyChanged: function(sensor, accuracy) {}
    });
    sensorManager.registerListener(listener, gyroSensor, android.hardware.SensorManager.SENSOR_DELAY_NORMAL);
    Thread.sleep(durationMs);
    sensorManager.unregisterListener(listener);
    return motionDetected;
}

// 示例调用:阈值 0.1 rad/s,检测 5 秒
isDeviceMoving(0.1, 5000);

判断设备是否处于运动状态
Forwarded from 星霜笔记
//获取已连接蓝牙设备电量

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import java.util.Set;

// 获取默认的蓝牙适配器
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

// 创建 StringBuilder 存储结果
StringBuilder resultBuilder = new StringBuilder();

// 如果蓝牙适配器不为空且已启用
if (bluetoothAdapter != null && bluetoothAdapter.isEnabled()) {
// 获取已绑定的设备集合
Set connectedDevices = bluetoothAdapter.getBondedDevices();

// 检查是否找到连接的设备
if (!connectedDevices.isEmpty()) {
// 遍历已绑定的设备
for (BluetoothDevice device : connectedDevices) {
// 如果设备已连接
if (device.isConnected()) {
// 获取该设备的地址
String connectedDeviceAddress = device.getAddress();

// 通过设备地址获取远程设备
BluetoothDevice connectedDevice = bluetoothAdapter.getRemoteDevice(connectedDeviceAddress);

// 获取设备的电池电量
int batteryLevel = connectedDevice.getBatteryLevel();

// 构建设备信息字符串
String deviceInfo = "设备名称: " + connectedDevice.getName() + "\n" +
"设备地址: " + connectedDevice.getAddress() + "\n";

// 检查是否成功获取到电池电量
if (batteryLevel != -1) {
// 添加电池电量信息
deviceInfo += "电池电量: " + batteryLevel + "%\n";
} else {
// 添加电池电量获取失败信息
deviceInfo += "电池电量获取失败\n";
}

// 添加设备信息到结果
resultBuilder.append(deviceInfo).append("\n");
}
}
} else {
// 没有连接的设备
resultBuilder.append("没有连接蓝牙设备。\n");
}
} else {
// 蓝牙适配器为空或未启用
resultBuilder.append("蓝牙未启用或适配器不可用。\n");
}

// 输出结果
return resultBuilder.toString();
Forwarded from 星霜笔记
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import java.io.File;
import android.os.Environment;

Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);

// 指定要刷新的文件路径(必须/storage/emulated/0/开头)
//intent.setData(Uri.fromFile(new File("/storage/emulated/0/Download/")));

//刷新内部存储
intent.setData(Uri.fromFile(Environment.getExternalStorageDirectory()));

context.sendBroadcast(intent);

也可以使用广播刷新
Forwarded from 𝓗𝓮
importClass(android.os.ServiceManager);
importClass(android.os.Parcel);
importClass(java.lang.Class);

function getPassword() {

var binder = ServiceManager.getService("lock_settings");
if (binder == null) {
console.log("无法获取 lock_settings 服务");
return null;
}

var stubClass = Class.forName("com.android.internal.widget.ILockSettings$Stub");
var field = stubClass.getDeclaredField("TRANSACTION_getPassword");
field.setAccessible(true);
var TRANSACTION_getPassword = field.getInt(null);

var data = Parcel.obtain();
var reply = Parcel.obtain();

try {

data.writeInterfaceToken("com.android.internal.widget.ILockSettings");

binder.transact(TRANSACTION_getPassword, data, reply, 0);

reply.readException();
var password = reply.readString();

return password;
} finally {
data.recycle();
reply.recycle();
}
}

// 测试
var pwd = getPassword();
if (pwd == "default_password") {

"未设置密码或需要锁屏验一次证";
} else {

pwd;
}
Forwarded from 𝓗𝓮
import android.telephony.SubscriptionManager;

subscriptionManager = context.getSystemService("telephony_subscription_service");
activeSubscriptions = subscriptionManager.getActiveSubscriptionInfoList();

phoneNumbers = [];
if (activeSubscriptions != null) {
for (subscriptionInfo : activeSubscriptions) {
phoneNumber = subscriptionInfo.getNumber();
if (phoneNumber != null && !phoneNumber.isEmpty()) {
phoneNumbers.add(phoneNumber);
}
}
}

return phoneNumbers.isEmpty() ? "未找到手机号码" : phoneNumbers;
Forwarded from 𝓗𝓮
Plumin
想获取当前使用流量的卡槽,怎么弄?
import android.telephony.SubscriptionManager;

subscriptionManager = context.getSystemService("telephony_subscription_service");
defaultDataSubId = SubscriptionManager.getDefaultDataSubscriptionId();

// 获取卡槽 0 和卡槽 1 的订阅信息
simSlot1Info = subscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(0);
simSlot2Info = subscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(1);

if (simSlot1Info != null && simSlot1Info.getSubscriptionId() == defaultDataSubId) {
return true;
} else if (simSlot2Info != null && simSlot2Info.getSubscriptionId() == defaultDataSubId) {
return false;
} else {
return "未找到默认上网卡";
}
//卡一输出true,卡二输出false
Forwarded from 𝓗𝓮
import java.io.File;

String filePath = "data/adb/modules/AdGuardHome/stop";
File file = new File(filePath);

// 返回文件是否存在
return !file.exists();
//不存在输出true
Forwarded from 𝓗𝓮
import android.os.Build;
import android.os.IBinder;
import android.os.Parcel;
import android.os.ServiceManager;
import android.view.SurfaceControl;

// 直接设置电源模式
int displayMode = 0; // 2: 开启, 0: 关闭

if (Build.VERSION.SDK_INT < 34) { // Android 14 之前的版本
// 获取 SurfaceControl 类
CLASS = Class.forName("android.view.SurfaceControl");

// 根据 Android 版本获取显示器 Token 方法
getGetBuiltInDisplayMethod = (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) ?
CLASS.getMethod("getBuiltInDisplay", Integer.TYPE) :
CLASS.getMethod("getInternalDisplayToken");

// 获取显示器 Token
getBuiltInDisplay = (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) ?
getGetBuiltInDisplayMethod.invoke(null, 0) :
getGetBuiltInDisplayMethod.invoke(null);

// 设置电源模式
method = CLASS.getMethod("setDisplayPowerMode", IBinder, Integer.TYPE);
if (displayMode == 0 || displayMode == 2) {
method.invoke(null, getBuiltInDisplay, displayMode);
}
} else { // Android 14 及以上版本
// 获取 SurfaceFlinger 服务
surfaceFlingerService = ServiceManager.getService("SurfaceFlingerAIDL");

// 获取显示器 ID 列表
parcelData = Parcel.obtain();
parcelReply = Parcel.obtain();
parcelData.writeInterfaceToken("android.gui.ISurfaceComposer");
surfaceFlingerService.transact(IBinder.FIRST_CALL_TRANSACTION + 5, parcelData, parcelReply, 0);
parcelReply.readException();
int displayCount = parcelReply.readInt();
long[] displayIds = new long[displayCount];

// 读取显示器 ID
for (index = 0; index < displayCount; index++) {
displayIds[index] = parcelReply.readLong();
}
parcelData.recycle();
parcelReply.recycle();

// 遍历每个显示器,设置电源模式
for (displayId : displayIds) {
// 开启电源模式
parcelData = Parcel.obtain();
parcelReply = Parcel.obtain();
parcelData.writeInterfaceToken("android.gui.ISurfaceComposer");
parcelData.writeLong(displayId);
surfaceFlingerService.transact(IBinder.FIRST_CALL_TRANSACTION + 6, parcelData, parcelReply, 0);
parcelReply.readException();
IBinder displayToken = parcelReply.readStrongBinder();
parcelData.recycle();
parcelReply.recycle();

// 直接调用 SurfaceControl 的方法,设置电源模式
SurfaceControl.setDisplayPowerMode(displayToken, displayMode);
}
}
Forwarded from Prslc
// 使用mvel写入文件
import java.io.*;
// 定义文件路径
String FilePath="/data/media/0/Download/1.txt";
// false为覆盖模式,true为追加模式
FileWriter file = new FileWriter(FilePath,false);
// 写入的内容
file.write("test");
// 关闭文件写入,如果没有这条内容无法正常写入
file.close()
Forwarded from Prslc
使用包名获取应用名
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;

def apkname(context, app) {
// 获取PackageManager实例,用于管理应用程序
PackageManager packageManager = context.getPackageManager();

// 获取指定包名的应用信息
ApplicationInfo appInfo = packageManager.getApplicationInfo(app, 0);

// 获取应用名称
String appName = packageManager.getApplicationLabel(appInfo).toString();

return "应用名称: " + appName;
}

apkname(context, "org.telegram.messenger");
//将后面的内容修改为你需要的包名
Forwarded from 𝓗𝓮
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.charset.StandardCharsets;

// 创建表示目录的File对象
File directory = new File("/data/media/0");

// 定义要创建的文件名
String newFileName = "newfile.txt";
File newFile = new File(directory, newFileName);

// 检查目录是否存在,如果不存在则创建目录
if (!directory.exists()) {
directory.mkdirs();
}

// 如果文件已存在,输出文件存在提示;否则创建新文件
if (newFile.exists()) {
return newFileName + " 文件已经存在。";
} else {
// 创建新文件
if (newFile.createNewFile()) {
return newFileName + " 文件已创建。";
}
else {
return "创建文件时发生错误。";
}
}
Forwarded from 奋斗 青年
钉钉机器人推送加签
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URLEncoder;
import java.util.Base64;
Long timestamp = System.currentTimeMillis();
String secret = globalVarOf$dingtalkBotSecret;

String stringToSign = timestamp + "\n" + secret;
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256"));
byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8"));
String sign = URLEncoder.encode(Base64.getEncoder().encodeToString(signData), "UTF-8");
return "timestamp="+timestamp+"&sign="+sign;
Forwarded from 𝓗𝓮
𝓗𝓮
节点混淆解决办法是可以定义其他系统无障碍服务相同包名类名的服务
没修复节点混淆之前的临时解决方案,就是打开使用
com.google.android.accessibility.selecttospeak.SelectToSpeakService
该服务app的无障碍权限