Code Monkey home page Code Monkey logo

pinpoint's Introduction

pinpoint

DEPRECATED

Due to changes in 10.13.4, Apple has removed the ability to enable Location Services automatically. With additional changes in 10.14 Apple has added more restrictions. Due to these restricts we no longer have the API calls to maintain this project and future development has stopped.

pinpoint logo

A python script for finding your Mac.

Author: Clayton Burlison - https://clburlison.com

Info

pinpoint is a python based script that is able to find the location of your Mac using either Apple's or Google's GeoLocation APIs.

Limited to 10.12-10.13.

More information can be found on the Wiki.

‼️ Munkireport users read this! ‼️

Legal Notice

pinpoint should only be installed on devices that you have authorization to do so on. Data collected from this project is directly uploaded to Apple, Inc. and Google, Inc. via GeoCoding APIs for in order to locate your Mac.

Usage of this project for illegal or immoral activities is deeply frowned upon. These activities could have consequences including fines and jail time depending on your location. I in no way endorse the usage of this project for these acts.

I am not a lawyer and all questions regarding the legality of this project within a specific organization should be taken up with a real lawyer.

Credits

Based off of works by:

Author Project Link
@arubdesu arubdesu/b72585771a9f606ad800
@pudquick pudquick/329142c1740500bd3797
@lindes lindes/get-location/
@chilcote chilcote/outset
@bollman jamf Nation #12300
Organization Project Link
University of Utah, Marriott Library privacy_services_manager
Munki FoundationPlist.py
Google Inc. supervisor

pinpoint's People

Contributors

clburlison avatar danner26 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pinpoint's Issues

Installing on macOS 10.13.1 APFS

Package Installed, but there were errors:

Nov 21 15:38:30 TECH-Zack McCauley installd[5400]: PackageKit: Executing script "./postinstall" in /private/tmp/PKInstallSandbox.Jdamg0/Scripts/com.clburlison.pinpoint.QqlKzp
Nov 21 15:38:30 TECH-Zack McCauley installd[5400]: ./postinstall: /Library/LaunchDaemons/com.clburlison.pinpoint.plist: service already loaded
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: ./postinstall: Traceback (most recent call last):
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: ./postinstall:   File "/Library/Application Support/pinpoint/bin/pinpoint", line 816, in <module>
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: ./postinstall:     main()
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: ./postinstall:   File "/Library/Application Support/pinpoint/bin/pinpoint", line 787, in main
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: ./postinstall:     ReverseLookup().address_lookup(address_lookup_service)
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: ./postinstall:   File "/Library/Application Support/pinpoint/bin/pinpoint", line 663, in address_lookup
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: ./postinstall:     add = dict(Address=str(address))
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: ./postinstall: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 3: ordinal not in range(128)
Nov 21 15:38:40 TECH-Zack McCauley installd[5400]: PackageKit: Writing receipt for com.clburlison.pinpoint to /

Latest release package, pinpoint-2.0.0.83.pkg

Update munkireport_prefs() to new domain

Rename the key to: google_address_lookup
Using AddressLookup. The differentiation between a Google and Apple lookup + reverse lookup will be handled in two additional keys.

This rename is to plan for the future. We hopefully will have full support for Apple & Google lookups and reverse lookups.

def munkireport_prefs():
"""Read MunkiReport preferences file to term if we should lookup the
client computers estimated address using Google's Reverse Geocode API."""
munki_report = "/Library/Preferences/MunkiReport.plist"
prefs = CFPreferencesCopyAppValue('ReportPrefs', munki_report)
if prefs:
if prefs.get('location_address_lookup'):
logging.info("address lookup enabled")
return True
else:
logging.info("address lookup disabled")
return False
else:
return True

Define lower floor for check_wait_period

As it stands someone can enter a value for CheckWaitTime that will not work as they intend. We have a random delay on our LaunchDaemon of 300 seconds. As such we should verify that the defined CheckWaitTime key is greater than 900 (delayrandom + StartInterval).

Without this someone could set the CheckWaitTime preference to something super low like 300 and not realize why pinpoint isn't running more frequently.

A simple logging.warn message of ("Your CheckWaitTime needs to be greater than 900").

Then a document this reasoning in the wiki. Maybe the Preferences page?

High Sierra Testing

Started testing with High Sierra. Changed Line 134
if not 8 <= int(os_vers()) <= 13:

Changed Line 299
if int(os_vers()) >= 13:

Everything is working as intended. Currently testing on a mac mini with High Sierra Beta 3.

Support for the 'Hide' option

Inside of the locationd client.plist I want a preference option, default to disabled, that can hide python. This should disable the location notification in the menu bar.

I will need to test this. Currently it is just an idea.

makefile for releases

  • pkg w/ postinstall script that loads LaunchD
  • dir structure of /Library/Application Support/pinpoint ?
    • Test if symbolic links can be inside of a payload. I've never tired this.
  • Add FoundationPlist.py so this project is self contained
  • I'm really starting to dislike /usr/local/bin thanks to homebrew's awful response to the community.
  • We are using /etc/path.d to load pinpoint globally instead of making a symbolic link.

Create LaunchDaemon

identifier: com.clburlison.pinpoint
Start Interval every 5 10 minutes?

Will need to add logic in pinpoint script to not run more than once every $integer preference time interval. Default that to ever 30 minutes, these should be in seconds for easier handling IE - 1800 seconds.

Handling ssid scanning exception

It's unclear if this is just a bug on 10.13 but I've managed to get airport command to give bad data multiple times tonight. This might be due to the very active wifi area that I'm in but Apple shouldn't give an incomplete file. 😞

# TODO (clburlison): This can error with
# FoundationPlist.FoundationPlist.NSPropertyListSerializationException: Encountered unexpected EOF # noqa
ssid_scan = FoundationPlist.readPlistFromString(ssid_scan)

Sierra support

Apple has updated the locationd daemon in Sierra. So pinpoint needs to be updated to support these changes. If doing an upgrade from 10.11 to 10.12 pinpoint will continue to work.

It would likely be best if I can reverse Apple's private framework and add the python binary using the same steps Apple is using. Will need to investigate.

Location lookup via Google does not work

I noticed in MunkiReport that my clients weren't updating the location with pinpoint. I ran this command manually on one machine to test:
sudo /Library/Application\ Support/pinpoint/bin/pinpoint -fvv
Here is the output:

[DEBUG]: Current LookupService is: google [DEBUG]: Updating 'LastCheckDate' timestamp [DEBUG]: Storing past location [DEBUG]: Wireless interface is currently: On [DEBUG]: Wireless interface is currently: On [DEBUG]: No preflight script on disk [INFO]: Scanning for wireless networks... Traceback (most recent call last): File "/Library/Application Support/pinpoint/bin/pinpoint", line 888, in <module> main() File "/Library/Application Support/pinpoint/bin/pinpoint", line 858, in main lookup(lookup_service) File "/Library/Application Support/pinpoint/bin/pinpoint", line 397, in lookup scan = wireless().wireless_scan() File "/Library/Application Support/pinpoint/bin/pinpoint", line 565, in wireless_scan ssid_scan = FoundationPlist.readPlistFromString(ssid_scan) File "/Library/Application Support/pinpoint/bin/FoundationPlist/FoundationPlist.py", line 105, in readPlistFromString raise NSPropertyListSerializationException(error) FoundationPlist.FoundationPlist.NSPropertyListSerializationException: Encountered unexpected EOF

Here are the preferences I have set:
{ AddressLookup = 1; AddressLookupService = google; CacheDir = "/Library/Application Support/pinpoint"; CheckWaitTime = 1800; DisableWireless = true; EnableWireless = true; LastCheckDate = "2017-11-15 14:59:49 +0000"; LookupService = google; }

This client I tested on is running 10.12.6

Support for a post_run script

The main idea behind this is to have the location.plist uploaded to an externally available logging system. I have the skeleton code for uploading to AWS s3 finished.

  • Handle errors gracefully. Though we should exit 0 when the post_run script works.
  • Add a 10 second time out. If your upload takes longer than 10 seconds you're doing something wrong.
  • Not sure if we should add a pre_run script however I'm open to ideas.
  • Add tinys3_upload_example.py

Store stale location data

When a lookup fails I would like to keep the past location data.

The easiest method for this is to read the on disk values into memory, run through the lookup, etc. and if a CurrentStatus message of 'Successful' is not returned write previously stored values back to disk.

Not sure why anyone would want this to be disabled so no preference key will be given.

Variable for lookup time

Still not sure how to best handle this.

Idea: If a lookup failed increase the lookup time and try again. Will need the lookup() def to have a loop for this to work.

Should increase from the initial time of 5 sec to 15?

Address is: Error Domain=kCLErrorDomain Code=2 "(null)"

I don't know if this is a change in pinpoint, a change in Apple's API or what, but all I get for reverse geocoding when LookupService is set to "apple" is the following:

Address is: Error Domain=kCLErrorDomain Code=2 "(null)"

I thought at first it might just be a temporary issue with Apple services but the problem has persisted for several months. It was occurring with pinpoint v1.0.0.77 and continues with v1.0.2.79.

Setting LookupService to 'google' returns the correct street address.

Debug output (with latitude/longitude redacted):

$ sudo pinpoint -fvv
[DEBUG]: Current LookupService is: apple
[INFO]: Location Services are enabled
[DEBUG]: Current location domain of client.plist is: 
[DEBUG]: {
    Authorized = 1;
    BundleId = "com.apple.locationd.executable-/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Executable = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Hide = 0;
    LocationTimeStopped = "501619995.550967";
    Registered = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Requirement = "cdhash H\"f77a66de9468d7b45045f9fa2f4ed5e4330863d8\" or cdhash H\"e8071e45cff63f1b3cf90ba010fea769aca77166\" or cdhash H\"4ee66de39dc92020e4d448664fd987795782ff54\" or cdhash H\"5ccab7b94f791e454aee9438ec5bf15c1a242a0b\"";
    Whitelisted = 0;
}
[INFO]: Python is enabled
[DEBUG]: Updating 'LastCheckDate' timestamp
[DEBUG]: Storing past location
[DEBUG]: Wireless interface is currently: On
[DEBUG]: No preflight script on disk
[DEBUG]: Running lookup loop: 0
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: [lat], [lon]
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: [lat], [lon]
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: [lat], [lon]
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: [lat], [lon]
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: [lat], [lon]
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: [lat], [lon]
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: [lat], [lon]
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: [lat], [lon]
[INFO]: Doing a reverse lookup via: apple
[INFO]: Address is: Error Domain=kCLErrorDomain Code=2 "(null)"
[DEBUG]: Writing current run details to: /Library/Application Support/pinpoint/location.plist
[INFO]: Current location: [lat], [lon]
[INFO]: Run status: Successful
[DEBUG]: No postflight script on disk

Happy to help debug or answer questions as needed. Thanks.

Use CoreWLAN for wifi scanning

Due to the bug in #34 we need to stop using airport. Luckily the code to switch to CoreWLAN is really easy. Should have a PR up in the next few days.

New LS Enable method

Use the following

sudo -u _locationd /usr/bin/defaults -currentHost write com.apple.locationd LocationServicesEnabled -bool TRUE

in place of

cmd = ['/usr/bin/defaults', 'write', das_plist,
'LocationServicesEnabled', '-int', '1']
subprocess.check_output(cmd)
os.chown(das_plist, 205, 205)

This removes the need to kill the locationd daemon. It might make other things place nicer as well.

Support for GoogleAPI lookup

Although CoreLocation works great for lookups some individuals might not want to mess with Location Services. Enabling support for lookup calls via Google's API requires us to do a scan for SSIDs and then process this data through Google to return an estimated location.

Some issues to solve:

  • Rewrite in Python
  • Cache last (variable) 10 locations based off uniqueness of SSIDs?
  • While doing a lookup if current SSIDs are 80-90% match cancel the lookup and use cached location (/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s --xml
  • Enable the -f flag to override the cached store and do a fresh lookup

Bash Example:
https://github.com/gmarnin/munkireport-php/blob/location-map/app/modules/location/scripts/location.sh#L19-L55

Give original credit to: Patrik Sonestad JNation @Bollman
https://jamfnation.jamfsoftware.com/discussion.html?id=12300

Umlauts in Adress Lookup?

Hello!

I tried pinpoint (for my munkireport install). Great project, but it seems to have problems when the address returned from google contains an umlaut (at least thatΒ΄s what I suspect):

INFO: Read current locationd settings
INFO: Location Services are enabled
DEBUG: Current location domain of client.plist is: 
DEBUG: {
    Authorized = 1;
    BundleId = "com.apple.locationd.executable-/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Executable = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Hide = 0;
    Registered = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Requirement = "cdhash H\"63f2adf4dac0829622cee884703685c693d4adfb\" or cdhash H\"7f059a96eff2890f320cfc9b4f9ee7f3ee664571\"";
    Whitelisted = 0;
}
INFO: Python is enabled
DEBUG: Updating 'LastCheckDate' timestamp
DEBUG: Storing past location
DEBUG: Wireless interface is currently: On
DEBUG: Running lookup loop: 0
INFO: Process a lookup request
DEBUG: Successful lookup request: 49.4488988417, 11.0870083546
INFO: Process a lookup request
DEBUG: Successful lookup request: 49.4488988417, 11.0870083546
INFO: Process a lookup request
DEBUG: Successful lookup request: 49.4488673252, 11.0870089456
INFO: Process a lookup request
DEBUG: Successful lookup request: 49.4488676288, 11.0870091044
INFO: Process a lookup request
DEBUG: Successful lookup request: 49.4488680774, 11.0870093973
INFO: Process a lookup request
DEBUG: Successful lookup request: 49.4488681514, 11.0870094331
INFO: Download json address file from Google
INFO: Download successful
Traceback (most recent call last):
  File "/Library/Application Support/pinpoint/bin/pinpoint", line 579, in <module>
    main()
  File "/Library/Application Support/pinpoint/bin/pinpoint", line 565, in main
    address_lookup('google')
  File "/Library/Application Support/pinpoint/bin/pinpoint", line 506, in address_lookup
    add = dict(Address=str(address),)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position 7: ordinal not in range(128)

Bye, Frido.

Support for Apple Reverse GeoLocate lookups

I would like to add the ability to Reverse Geocode via CoreLocation's Gecoder. Apple has a less strict API when it comes to requests so this would ideally become the new default setting. The only issue I'm running into is no one has done this in PyObjC which means it needs to be converted. I'm running into issues with this conversion.

Apple has an ObjectiveC demo below.

https://developer.apple.com/library/ios/samplecode/GeocoderDemo/Listings/GeocoderDemo_ReverseViewController_m.html

MunkiReport on High Sierra is unable to poll location from pinpoint successfully

As discussed on Slack, I've noticed that for some reason munkireport is unable to successfully determine an address, however a manual run of the pinpoint command seems to work just fine. Here's what I've gathered from logs:

Last Successful run on Sierra:

2018-02-23 09:11:10 AM [DEBUG]: Current LookupService is: apple
2018-02-23 09:11:10 AM [INFO]: Location Services are enabled
2018-02-23 09:11:10 AM [DEBUG]: Current location domain of client.plist is:
2018-02-23 09:11:10 AM [DEBUG]: {
    Authorized = 1;
    BundleId = "org.python.python";
    BundlePath = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app";
    Executable = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Hide = 0;
    LocationTimeStopped = "541085498.158873";
    Registered = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Requirement = "identifier \"org.python.python\" and anchor apple";
    Whitelisted = 0;
}
2018-02-23 09:11:10 AM [INFO]: Python is enabled
2018-02-23 09:11:10 AM [DEBUG]: Updating 'LastCheckDate' timestamp
2018-02-23 09:11:10 AM [DEBUG]: Storing past location
2018-02-23 09:11:10 AM [DEBUG]: Wireless interface is currently: Off
2018-02-23 09:11:11 AM [DEBUG]: Wireless adapter has been turned on.
2018-02-23 09:11:16 AM [DEBUG]: Wireless interface is currently: On
2018-02-23 09:11:16 AM [DEBUG]: No preflight script on disk
2018-02-23 09:11:16 AM [DEBUG]: Running lookup loop: 0
2018-02-23 09:11:16 AM [INFO]: Process a lookup request via: apple
2018-02-23 09:11:16 AM [DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
2018-02-23 09:11:16 AM [INFO]: Process a lookup request via: apple
2018-02-23 09:11:16 AM [DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
2018-02-23 09:11:16 AM [INFO]: Process a lookup request via: apple
2018-02-23 09:11:16 AM [DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
2018-02-23 09:11:17 AM [INFO]: Process a lookup request via: apple
2018-02-23 09:11:17 AM [DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
2018-02-23 09:11:17 AM [INFO]: Process a lookup request via: apple
2018-02-23 09:11:17 AM [DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
2018-02-23 09:11:18 AM [INFO]: Process a lookup request via: apple
2018-02-23 09:11:18 AM [DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
2018-02-23 09:11:18 AM [INFO]: Process a lookup request via: apple
2018-02-23 09:11:18 AM [DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
2018-02-23 09:11:21 AM [INFO]: Doing a reverse lookup via: apple
2018-02-23 09:11:24 AM [INFO]: Address is: ADDRESS
2018-02-23 09:11:24 AM [DEBUG]: Writing current run details to: /Library/Application Support/pinpoint/location.plist
2018-02-23 09:11:24 AM [INFO]: Current location: XXX.XXXX, YYY.YYYY
2018-02-23 09:11:24 AM [INFO]: Run status: Successful
2018-02-23 09:11:24 AM [DEBUG]: No postflight script on disk
2018-02-23 09:11:24 AM [DEBUG]: Wireless interface is currently: On
2018-02-23 09:11:24 AM [DEBUG]: Wireless adapter has been turned off.

Run by MunkiReport after upgrading to High Sierra :

2018-02-23 01:01:42 PM [DEBUG]: Current LookupService is: apple
2018-02-23 01:01:42 PM [INFO]: Location Services are enabled
2018-02-23 01:01:42 PM [DEBUG]: Current location domain of client.plist is:
2018-02-23 01:01:42 PM [DEBUG]: {
    Authorized = 1;
    BundleId = "org.python.python";
    BundlePath = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app";
    Executable = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Hide = 0;
    LocationTimeStopped = "541090448.376866";
    Registered = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Requirement = "identifier \"org.python.python\" and anchor apple";
    Whitelisted = 0;
}
2018-02-23 01:01:42 PM [INFO]: Python is enabled
2018-02-23 01:01:42 PM [DEBUG]: Updating 'LastCheckDate' timestamp
2018-02-23 01:01:43 PM [DEBUG]: Storing past location
2018-02-23 01:01:44 PM [DEBUG]: Wireless interface is currently: Off
2018-02-23 01:01:45 PM [DEBUG]: Wireless adapter has been turned on.
2018-02-23 01:01:51 PM [DEBUG]: Wireless interface is currently: On
2018-02-23 01:01:51 PM [DEBUG]: No preflight script on disk
2018-02-23 01:01:51 PM [DEBUG]: Running lookup loop: 0
2018-02-23 01:01:57 PM [DEBUG]: Running lookup loop: 1
2018-02-23 01:02:07 PM [DEBUG]: Running lookup loop: 2
2018-02-23 01:02:22 PM [INFO]: Doing a reverse lookup via: apple
2018-02-23 01:02:22 PM [WARNING]: Unable to determine address
2018-02-23 01:02:22 PM [INFO]: Address is: Unable to determine address
2018-02-23 01:02:22 PM [WARNING]: Error obtaining a location. LS was unresponsive or a lookup timeout occurred.
2018-02-23 01:02:22 PM [DEBUG]: Keep past location as we were unable to determine your current location
2018-02-23 01:02:22 PM [DEBUG]: Writing current run details to: /Library/Application Support/pinpoint/location.plist
2018-02-23 01:02:22 PM [DEBUG]: No postflight script on disk
2018-02-23 01:02:22 PM [DEBUG]: Wireless interface is currently: On
2018-02-23 01:02:22 PM [DEBUG]: Wireless adapter has been turned off.

Manual run on High Sierra:

sudo pinpoint -vvf
Password:
[DEBUG]: Current LookupService is: apple
[INFO]: Location Services are enabled
[DEBUG]: Current location domain of client.plist is:
[DEBUG]: {
    Authorized = 1;
    BundleId = "org.python.python";
    BundlePath = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app";
    Executable = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Hide = 0;
    LocationTimeStopped = "541362526.998613";
    ReceivingLocationInformationTimeStopped = "541362528.378777";
    Registered = "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python";
    Requirement = "identifier \"org.python.python\" and anchor apple";
    Whitelisted = 0;
}
[INFO]: Python is enabled
[DEBUG]: Updating 'LastCheckDate' timestamp
[DEBUG]: Storing past location
[DEBUG]: Wireless interface is currently: Off
[DEBUG]: Wireless adapter has been turned on.
[DEBUG]: Wireless interface is currently: On
[DEBUG]: No preflight script on disk
[DEBUG]: Running lookup loop: 0
[WARNING]: Apple lookup request failed
[DEBUG]: Unsuccessful lookup request: Unable to locate
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
[INFO]: Process a lookup request via: apple
[DEBUG]: Successful lookup request: XXX.XXXX, YYY.YYYY
[INFO]: Doing a reverse lookup via: apple
[INFO]: Address is: ADDRESS
[DEBUG]: Writing current run details to: /Library/Application Support/pinpoint/location.plist
[INFO]: Current location: XXX.XXXX, YYY.YYYY
[INFO]: Run status: Successful
[DEBUG]: No postflight script on disk
[DEBUG]: Wireless interface is currently: On
[DEBUG]: Wireless adapter has been turned off.

After this, the plist file is properly updated and on the next run of MunkiReport the new data is reported to the server. If I leave these to their own devices the address info goes to a 'stale' status after a couple of days.

Intermittent failures with munkireport

I'm finding that on many of my clients pinpoint/location fails with an error, even on first run. But many times it runs once successfully and reports a stale location thereafter.

Error obtaining a location. LS was unresponsive or a lookup timeout occurred.

I ran pinpoint -f on a few clients, it found a new location and that appeared in MR after I ran managedsoftwareupdate

toggle_wireless broken

During wireless refactor (846e200) I broke the toggle_wireless function.

The traceback is:

Traceback (most recent call last):
  File "./pinpoint", line 888, in <module>
    main()
  File "./pinpoint", line 843, in main
    WirelessOutput = wireless().toggle_wireless('on')
  File "./pinpoint", line 585, in toggle_wireless
    iface = CWInterface.interface()
NameError: global name 'CWInterface' is not defined

Thanks to @hjlinde for the report

Remove FoundationPlist for prefs

I've known for a few years now that /var/db/locationd/client.plist was a preference file. As such, we should stop using FoundationPlist and use CFPreferencesSetMultiple. I have a sample https://github.com/clburlison/Munki-s3Repo-Plugin/blob/master/prefSetter.py that should work for getting started.

This is kind of tricky because we need to write this file out as the _locationd user (uid: 205) and not the root user. The easiest method is to use multithreading with os.setuid.

This might allow us to stop with the kill cfprefsd and locationd code which was always a hack. Doing so might also improve reliability.

If anyone wants to take a stab at this I'll be more than happy to help alone with any implementation details/issues else I'll get to it when I can.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.