public async Task <string> Apk(string ApkPath) { Flows = new Flows(EndPoint); await Flows.ConnectFlow <WriteMessage>(Systems.Host); FileInfo Info = new FileInfo(ApkPath); OkayMessage OpenOkay = await Flows.OpenFlow <OkayMessage>(LocalID, $"exec:cmd package 'install' -S {Info.Length}\0"); RemoteID = OpenOkay.Argument1; byte[] Data = File.ReadAllBytes(Info.FullName); decimal FileLength = Info.Length; decimal MaxData = Constants.MaxData; decimal Rounds = Math.Ceiling(FileLength / MaxData); for (int i = 0; i < Rounds + 1; i++) { OkayMessage WriteOkay = await Flows.WriteFlow <OkayMessage>(LocalID, RemoteID, Data.Skip((int)(Constants.MaxData * i)).Take((int)Constants.MaxData).ToArray()); } WriteMessage InstallResult = await Flows.RecievePayloadFlow <WriteMessage>(LocalID, RemoteID); CloseMessage CloseResult = await Flows.SendCloseFlow <CloseMessage>(LocalID, RemoteID); return(Encoding.UTF8.GetString(InstallResult.Payload)); }
private async Task <Message> OpenShellFlow() { Flows = new Flows(EndPoint); WriteMessage WriteMessage = await Flows.ConnectFlow <WriteMessage>(Systems.Host); OkayMessage OpenOkay = await Flows.OpenFlow <OkayMessage>(LocalID, $"shell,v2,pty:\0"); RemoteID = OpenOkay.Argument1; OkayMessage WriteOkay = await Flows.WriteFlow <OkayMessage>(LocalID, RemoteID, "\x05\v\0\0\030x120,0x0\0"); WriteMessage ConsoleWelcome = await Flows.RecievePayloadFlow <WriteMessage>(LocalID, RemoteID); Username = SimulateConsole(Encoding.UTF8.GetString(ConsoleWelcome.Payload))[0]; Username = Username.Split('/')[0]; IsIntialized = true; return(ConsoleWelcome); }
public async Task <string> Enable() { if (IsRoot) { return("adbd is already running as root"); } Flows = new Flows(EndPoint); await Flows.ConnectFlow <WriteMessage>(Systems.Host); OkayMessage OpenOkay = await Flows.OpenFlow <OkayMessage>(LocalID, $"root:\0"); RemoteID = OpenOkay.Argument1; WriteMessage Result = await Flows.RecievePayloadFlow <WriteMessage>(LocalID, RemoteID, false); CloseMessage CloseRequest = await Flows.RecieveCloseFlow <CloseMessage>(LocalID, RemoteID); IsRoot = true; return(Encoding.UTF8.GetString(Result.Payload)); }
private async Task <WriteMessage> Connect() { Flows = new Flows(EndPoint); return(await Flows.ConnectFlow <WriteMessage>(Systems.Host)); }