Set network card to AP mode in OSX - macos

I am trying to do OSX's internet sharing from the command line and there doesn't seem to be a command for it, so I'm trying to do it manually by turning the network card to access point mode. I can't seem to find anything about how to turn the wireless card into AP mode on the mac. Linux would use iwconfig (which OSX doesn't have) and I've monitored the files that network sharing opens, but no dice so far.
It looks related to wifid, but the documentation for wifid only says "Don't invoke wifid directly". Also played with the airportd command, but it doesn't seem to let the card go into AP mode. There must be a way to do it, since internet sharing creates an access point.
TL;DR:Does anyone know how to turn on Internet Sharing from the command line?

Related

Is there a faster way to connect to a Bluetooth device from cmd/powershell than btcom from Bluetooth command line tools?

I've put together a Powershell script to allow me to connect my Bluetooth headphones to my PC without having to open the Bluetooth settings page each time (based on the ones in https://github.com/stanleyguevara/win10-bluetooth-headphones, but using Get-PnPDevice and Get-PnPDeviceProperty to check whether the device is connected rather than using an environment variable to save the state).
The script works, but there's one big QoL issue. The script uses the Bluetooth command line tools here to connect/disconnect the device (in particular, it uses the btcom command). However, these commands are very slow to run, with the whole process taking around a minute total. This is true even though I am using the device's MAC address to connect, and not its friendly name (which would be even slower). This makes using the script much slower than just opening the settings panel each time (though opening the settings panel is less convenient since it requires opening and going through multiple windows).
I've seen many questions about this sort of thing (how to connect/disconnect a Bluetooth device from cmd/powershell, but everything I've seen regarding Windows tends to suggest using the Bluetooth command line tools at the link above, so they don't solve the speed issue. Other things I've found suggest disabling the Bluetooth adapter entirely, which isn't what I want to do. Others suggest using the Win+K shortcut to open up the connections sidepanel, but this doesn't really address the question of whether there's a way to do this from cmd/powershell, and is slightly less automated since you have to wait a second for the list to populate and manually navigate to the device to connect/disconnect (though at least it solves the problem of opening a bunch of windows).
Is there a way to connect/disconnect from a Bluetooth device in cmd/powershell that is faster than btcom?

Unbinding mmcblk1 driver in Linux (disable SD Card Reader)

I'm pretty new to the Linux device tree, and I am searching for a way to disable the SD Card Interface on my Linux embedded system.
I recently figured out how to disable my USB Interface by unbinding it's device driver, using echo -n 1-0:1.0 > /sys/bus/usb/drivers/hub/unbind
Now I am trying to do the same for the SD Card slot, but I am running into problems finding the correct path/driver to unbind. I believe the device is located in /sys/block/mmcblk1, but I'm not really sure how to go about finding the correct device id/unbind file. Any tips on disabling an SD interface?
Edit 1: Upon further inspection, mmcblk1 doesn't even show up when there is no SD card inserted in the slot. How should I go about disabling the interface itself, not just disabling a single card?
Edit 2: It looks like disabling hotplugging might work, but I am now struggling to understand mdev rules.
Edit 3 (Solution): After slogging through the device tree, I was able to track down the specific device and driver combination that was running my mmc reader. echo -n mmc1:aaaa > /sys/bus/mmc/drivers/mmcblk/unbind is able to unbind the driver from the device (mmc1:aaaa). I also had to tweak my mdev rules, as the driver was reloaded every time I plugged in my device. The final solution was to drop the following into /etc/mdev.conf: mmcblk([1-9]+) root:disk 777 #echo -n mmc1:aaaa > /sys/bus/mmc/drivers/mmcblk/unbind, which runs every time an mmc device binds (excluding mmcblk0, as we are using that elsewhere) and immediately unbinds the driver.
You can try blacklisting /lib/modules/$(uname -r)/kernel/drivers
/mmc/core/mmc_block.ko.xz.
Create the file /etc/modprobe.d/blacklist_sdcard.conf and add the line: "blacklist mmc_block" without the quotes, and then reboot.
Note that this might disable other devices on your system if something else uses it, so you might discover you've created a problem.
edit
Sorry the above didn't work for you. I was also concerned that other things were using the device driver.
This should do it:
Create /etc/udev/rules.d/99-disable-automount.rules
and add the line:
ACTION=="add|change",KERNEL=="sdb",ENV{UDISKS_IGNORE}="1"
using whatever device the card reader mounts as for the "KERNEL==" section.
Then do udevadm control --reload
and you should be all set.

Using USB keyboard device to trigger terminal commands on raspberry pi

I have a small robot which runs on a raspberry pi.
I need to be able to control it with an RF remote to trigger a few different terminal commands which run short python scrips.
Previously I did this with a GUI on my macbook, triggering these commands over ssh, but I now need to be able to trigger them in the absence of an internet connection.
The remote I bought is:
https://www.adafruit.com/products/3092?gclid=CNPj7LjTgNECFdOPswodsiULYA
I realize that this is designed for OSMC.
This remote shows up as a USB keyboard on the Pi, which makes the challenge more general:
* - How could one rig a 'USB keyboard device' to trigger entire terminal commands with the click of one key?*
My low-level knowledge of hardware is limited, and my programming experience extends little beyond python.
Any direct solution or suggested reading is much appreciated.
I am also open to alternatives, however I do not have time to order new hardware online.
You could write a python script which uses the 'os' library to interact with the terminal, have it looking for certain keystrokes and then writing the relevant commands to the terminal via os.
e.g
if (KEY == "F"):
os.system("cd Dropbox")
I have no idea how to do formatting here, but you get the idea.

Disabling an input device (keyboard, mouse) which is used in current session

I'm developing a filter driver which works on top of an input device. Notably I'm testing it on my development machine (and yes, I know this is a bad idea).
On Windows XP whenever I needed to reload the filter driver, I'd just execute a batch file that would disable-enable the relevant devices through devcon, thus cause my filter driver to unload and reload.
However, on Windows 7 there seems to be a specific measure built against disabling the input device which your session is using. The option simply becomes unavailable in the Device Manager and even devcon no longer works. It does work from a remote desktop session, along with the kernel debug print "Trying to disable physical device not enabled in this session." (which hints that something explicit is allowing me to do this).
Is there a way to disable this functionality of Windows 7? Or perhaps a workaround you can offer to run my disable-enable batch file from an unrelated session?
Using Sysinternals psexec to run dpinst.exe works around this limitation. (Not sure why, since the DpInst UI is still being displayed.)

Change MAC-Address in iOS5

I Used to change my Mac Adress in Open Networks with the command:
ifconfig eth0 ether 00:11:22:33:44:55
in iOS4 this was no Problem, i remember there was even an App on Cydia for that. For ifconfig i instaklled network-tools from BigBoss Source.
Since iOS5 the Command is going thru Terminal without any error, however the MAC-Address isnt changing anymore... Someone a Idea on how to change it?
It's possible. For some reason, spoofing it in iOS 5 won't work (either via command line or MacX4), but you could always rewrite it in hardware. There are several cons to this and this is not worth during unless you absolutely have to: it will break your music player (so you have to use VLC or the like), is permanent even after reboot, and effectively changes your UDID (so betas will not work and the device will be unregistered).
nvram wifiaddr="XX:XX:XX:XX:XX"
Again, the cons definitely outweigh the pros here. I'm sure eventually someone will come up with the software to do a spoof, not a total rewrite.
It can be done. My iPad running 5.01 has an arbitrary MAC. There are no restrictions as far as playing music, and I am still able to access Apple services (at least those that I use personally) without hindrance. It's a moderately tedious process, but after a bunch of failed attempts I was able to successfully (and permanently unless I decide to repeat the process using my originals) change the values with a combination of terminal commands, DFU/recovery cycles, OSX apps, and a clean restore via iTunes. If anyone is still interested, I would be willing to outline the process. I would do so now, but I have to hash out some specifics concerning the iTunes host file.
Because the MAC address is unchangeable for a reason?

Resources