How to capture USB traffic with Wireshark in OSX Catalina (10.15) - macos

I am trying to get Wireshark USB captures working. Apparently the trick prior to Catalina was to just bring the interface up so that Wireshark could see it.
https://forums.developer.apple.com/thread/95380
However, this does not work in Catalina because the USB hubs are not shown as interfaces any longer. Is there another known way to "bring up" these interfaces in OSX? Perhaps a new system policy setting? How would one go about finding such a thing?
It might just be broken now. I imagine Wireshark and ifconfig use the same API to gather info about the interfaces.

You need to disable SIP first
Restart your Mac
Hold down Command-R to reboot into Recovery Mode
Click Utility->Terminal, type "csrutil disable", click Enter.
Restart your Mac
then you can use "sudo ifconfig XHC20 up" command

Related

Turn On macOS Screen Remotely

Is there a way to turn on the monitor remotely on macOS? I'm trying to write an app that will do this.
I've tried a couple of things but can't seem to find a way of triggering the screen to turn on after it has been turned off for power saving.
I've got a macOS app that advertises itself on the network via Bonjour. I can communicate to it via sockets, even when the computer is sleeping. However, I'm not sure what I can do from this macOS app that would trigger the screen to come on. I've tried sending a WoL packet and I've tried using Caffiene.
The macOS app doesn't need to pass Apple Review so I'm fine with using private APIs if necessary.

Windows OS: Connected dev board not visible in mdt using Git Bash

Doc I followed - https://coral.ai/docs/dev-board/get-started/#install-mdt
Python3 version: 3.9
What I have done
Flashed the board with a microSD card.
I have installed MDT and it is working fine.
Connected the dev board via USB, confirmed a new Network Adapter (Remote NDIS Compatible
Device) shows up in Device Manager
Ran mdt devices
What the docs said should happen
connected dev board should be listed
What actually happened
After waiting for some time nothing gets listed (mdt cannot see the
connected device)
Running mdt wait-for-device stalls in "Waiting for device..."
Running mdt shell gives the error, "Waiting for a device... Unable to find any devices on your local network segment."
This might not be the best way to do this, but this did the trick for me:
First connect your board to your PC.
Go to Control Panel > Network and Internet > Network and Sharing Center
Here you will see an Unidentified network click on it and go to Properties.
In properties, go to Sharing and check Allow other network users to connect through this computer's internet connection.
Now try running mdt shell command.
After you have successfully connected your board, make sure to uncheck the previous option in Network Sharing.
I did the above but it did not fix my problem. Here is what fixed it -
Apparently the dev board is seen as a unidentified network under public networks. My Windows Firewall settings blocked python.exe from writing to or reading to public networks. I did the following -
How to check if Windows Firewall is blocking a program
Press Windows Key + R to open Run.
Type control and press OK to open Control Panel.
Click on System and Security.
Click on Windows Defender Firewall.
From the left pane Allow an app or feature through Windows Defender Firewall.
In the allowed apps window, scroll through all the apps.
Locate the app you want to review and see if the app is checked.
(Here the python.exe was not checked. I changed the setting and voila, mdt devices finds the device and everything works on from here.)
If it is unchecked, the app is blocked on the Firewall.
If your program is blocked, simply check the app and click OK.

How can I see Debug.Log output in MonoDevelop Unity when connected to a device?

When debugging in Unity Editor I can see the Debug.Log() output in the Console, which is great. However, when connecting MonoDevelop to a device I don't know where to find this output. It is not in the "Application Output" window. Breakpoints, variables, stack - all works fine. Is there a way to see the debug output in MonoDevelop?
Is there anything better then this answer suggests? Debug/Trace output in MonoDevelop
1) Enable "USB debugging" on your device and connect the device to your development machine via USB cable. Ensure your device is on the same subnet mask and gateway as your development machine. Also, make sure there are no other active network connections on the device (i.e. disable data access over mobile/cellular network).
2) On your development machine, open up your terminal/cmd and navigate to the location of the ADB. You can find the ADB tool in /platform-tools/
3) Restart host ADB in TCP/IP mode with the following command:
adb tcpip 5555
This should produce the following output:
restarting in TCP mode port: 5555
This will have enabled ADB over TCP/IP using port 5555. If port 5555 is unavailable, you should use a different port.
(See http://developer.android.com/tools/help/adb.html)
4) Find out the IP address of your Android device (Settings -> About -> Status) and input the following command:
adb connect DEVICEIPADDRESS
(DEVICEIPADDRESS is the actual IP address of your Android device)
This should produce the following output:
connected to DEVICEIPADDRESS:5555
5) Ensure that your device is recognised by inputting the following command:
adb devices
This should produce the following output:
List of devices attached
DEVICEIPADDRESS:5555 device
6) Build and run your Unity application to the device. Ensure you build your application with Development Build flag enabled and Script Debugging turned on.
7) The device no longer needs to be connected to your development machine via USB.
8) Finally, while the application is running on your device, open your script in MonoDevelop, add a breakpoint, select "Run" -> "Attach to Process" and select your device from the list. (Note that it might take a few seconds for the device to appear in the list. It may not appear in the list if the application is not running or if the device's display goes to sleep).
For some more details and for troubleshooting, see the Wireless Usage section in the Android developers guide for the ADB: http://developer.android.com/tools/help/adb.html#wireless
NB:
The device sends multicast messages and the editor and MonoDevelop subscribe/listen for them. For this to work, your network will need to be setup correctly for Multicasting.
Taken From here
There are other ways also to debug your application in terminal
******************* On MacOS ***************************
Start Terminal from launchpad
First Method
Turn USB Debugging on, on your android device
Connect the android device through usb cable
Go to “platform-tools” folder in Adroid sdk folder by using “cd”
command
Connect the android device through usb cable
type “adb devices” in terminal it will print the list of devices
attached
type “adb logcat -s Unity ActivityManager PackageManager dalvikvm
DEBUG” to see logcat of only unity related stuffs
Second Method
creating an environment variable to access ADB directly
Go to your home directory by typing “cd ~”
Type touch .profile this will create a hidden file named profile
Type open -e .profile this will open the file you just created in
TextEdit
In the file, type export
PATH=${PATH}:/AndroidSdkPath/android-sdk-mac_86/platform-tools
Save file, close TextEdit, Quit Terminal, and Relaunch Terminal
Turn USB Debugging on, on your android device
Connect the android device through usb cable
type “adb devices” in terminal it will print the list of devices
attached
type “adb logcat -s Unity ActivityManager PackageManager dalvikvm
DEBUG” to see logcat of only unity related stuffs
Now you can start your app/game on the target device and Terminal will log all the activities of your app.
Solved!
Install "Visual Studio Community 2015" - Free to use
Install "VS tools for Unity" https://www.visualstudio.com/en-us/features/unitytools-vs.aspx - Free!
Add Package in Unity as explained https://msdn.microsoft.com/en-us/library/dn940025.aspx
Run, attach the debugger and look into the "Error List" window - Log message will appear there as "Messages".
Should the above does not work, check this: https://msdn.microsoft.com/en-us/library/dn940025.aspx , in particular: "Took a while but finally found a very simple thing that I was not aware of - being a newbie - There is a filter button on the error list, which didn't look like it was clickable, so I clicked that and messages are now coming through, who knew?"

associating to an encrypted ssid from mac os x command line

I have a bunch of macbook pro and air laptops which are being controlled through SSH.
At this point I need to make them associate to an encrypted SSID. The command that I use is:
sudo networksetup -setairportnetwork en0 test-ssid 12345678 where test-ssid is the ssid that we connect to and 12345678 is the password.
When I issue this command through SSH it halts and a pop-up window appears on the laptop GUI where it says: "networksetup wants to access key "test-ssid" in your keychain with the options "Always Allow", "Deny" and "Allow"
Is there a way to make this window not appear and have the laptop simply connect to the ssid? I don't have a regular access to the laptop GUI and the SSID names constantly change so I can't really manually hit accept every time I need to connect a bunch of laptops.
Thanks in advance!
This is basically an issue with the older OS X versions. Works fine on Yosemite which I was hesitant to upgrade to.

osx lion never stays in sleep mode

Since I updated to OSX Lion I got a strange issue.
I am used to never shut down my Mac, I simply put it in hibernate / sleep mode.
But since the update to Lion the mac just starts up at random times.
Day and Night I can hear the CD-Drive sound when it wakes up.
The screen does not even go on, it stays black but the as soon as you hit any key the monitor just turns on.
This is really annoying as it sometimes wakes you up at night when you MAC is booting up.
I could not find a similar issue reported yet.
Thanks
Sebastian
Given the RTC (Alarm) wake reason, ensure Wake for network activity is turned off. See the last comment in the thread at https://discussions.apple.com/thread/3247367?start=0&tstart=0
Also ensure you have not scheduled wake. See http://osxdaily.com/2010/07/17/why-mac-wakes-from-sleep/
Launch the Terminal and type the following at the command line:
syslog |grep -i "Wake reason"
OHC: stands for Open Host Controller, is usually USB or Firewire. If you see OHC1 or OHC2 it is almost certainly an external USB keyboard or mouse that has woken up the machine.
EHC: standing for Enhanced Host Controller, is another USB interface, but can also be wireless devices and bluetooth since they are also on the USB bus of a Mac.
USB: a USB device woke the machine up
LID0: this is literally the lid of your MacBook or MacBook Pro, when you open the lid the machine wakes up from sleep.
PWRB: PWRB stands for Power Button, which is the physical power button on your Mac
RTC: Real Time Clock Alarm, is generally from wake-on-demand services like when you schedule sleep and wake on a Mac via the Energy Saver control panel. It can also be from launchd setting, user applications, backups, and other scheduled events.
Hope this fixes your problem.

Resources