Performing an external sharing audit; counting shares by domain

362 views
Skip to first unread message

Ian Hyzy

unread,
Sep 10, 2018, 6:56:51 PM9/10/18
to GAM for G Suite
I'd like to audit who users are using external sharing with in our domain. For example, I'd like to scan every user's Drive files and count how many times a doc was shared with @domain.com, then get a list of how often docs were shared with each domain. For example, one line might say: 50 users shared 200 files with Domain.com. 

I did an export with all of the permission and I'm having trouble figuring out a way to do this nicely as each permission entry appears as a new set of columns and my Excel-fu isn't quite good enough to figure out how to suss out the data I need. I looked into the Drive Query API selections linked on the documentation page but nothing jumped out at me as an obvious solution. I'm also looking at modifying GetUserShareCounts.py from the gam-scripts repo as it looks to get pretty close but I was hoping for something simpler.

Right now, I was able to manually sort/filter to get a list of domains but that's it. The .csv is also 500MB so I have no way to load the entire thing in Sheets, only Excel/Libreoffice. 

If anyone has an idea of how to accomplish this, I'm all ears!

Thanks,
Ian

Ross Scroggs

unread,
Sep 10, 2018, 7:47:59 PM9/10/18
to google-ap...@googlegroups.com
Ian,

What more do you want from GetUserShareCounts.py?

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/b0885527-2d1c-47a7-b0f5-7d62e66e52c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Ian Hyzy

unread,
Sep 11, 2018, 5:16:36 PM9/11/18
to GAM for G Suite
Hi Ross,

I haven't gotten the script to work just yet, so correct me if I'm wrong but: it looks like the script will return a count of documents just by sharing setting:

Shared External - number of files shared publically (anyone) or to a domain/group/user where the domain is not in DOMAIN_LIST

I would be looking for this information, but instead of counts by document: eg 100 files shared externally, I'd be looking for 50 files shared externally with domain.com, 50 files shared externally with domain2.com


On Monday, September 10, 2018 at 6:47:59 PM UTC-5, Ross Scroggs wrote:
Ian,

What more do you want from GetUserShareCounts.py?

Ross

On Mon, Sep 10, 2018 at 3:56 PM Ian Hyzy <ian....@mavenwave.com> wrote:
I'd like to audit who users are using external sharing with in our domain. For example, I'd like to scan every user's Drive files and count how many times a doc was shared with @domain.com, then get a list of how often docs were shared with each domain. For example, one line might say: 50 users shared 200 files with Domain.com. 

I did an export with all of the permission and I'm having trouble figuring out a way to do this nicely as each permission entry appears as a new set of columns and my Excel-fu isn't quite good enough to figure out how to suss out the data I need. I looked into the Drive Query API selections linked on the documentation page but nothing jumped out at me as an obvious solution. I'm also looking at modifying GetUserShareCounts.py from the gam-scripts repo as it looks to get pretty close but I was hoping for something simpler.

Right now, I was able to manually sort/filter to get a list of domains but that's it. The .csv is also 500MB so I have no way to load the entire thing in Sheets, only Excel/Libreoffice. 

If anyone has an idea of how to accomplish this, I'm all ears!

Thanks,
Ian

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.


--

Ian Hyzy

unread,
Sep 11, 2018, 5:20:36 PM9/11/18
to GAM for G Suite
If it helps, this is the error I'm getting with the python script: 

PS C:\Users\ianhy> python GetUserShareCounts.py filelistperms.csv usersharecounts.csv
Traceback (most recent call last):
 
File "GetUserShareCounts.py", line 80, in <module>
    outputCSV
.writeheader()
 
File "C:\Users\ianhy\AppData\Local\Programs\Python\Python36-32\lib\csv.py", line 144, in writeheader
   
self.writerow(header)
 
File "C:\Users\ianhy\AppData\Local\Programs\Python\Python36-32\lib\csv.py", line 155, in writerow
   
return self.writer.writerow(self._dict_to_list(rowdict))
TypeError: a bytes-like object is required, not 'str'

Ross Scroggs

unread,
Sep 11, 2018, 7:20:54 PM9/11/18
to google-ap...@googlegroups.com

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.


--

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.


--
Reply all
Reply to author
Forward
0 new messages