opendns-fetchstats

Comments

105 comments

  • Avatar
    wtc.dan

    When running the script using a 5-digit org ID, I get either "You cannot access xxxxx" or "You cannot access all" if I try to use "all".  I am a Full Admin.

    When trying to visit 

    https://dashboard.opendns.com/stats/all/topdomains/

    it redirects me to 

    https://dashboard2.opendns.com/msp

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    This script cannot be used to fetch stats for the Enterprise (Umbrella) line of services.  It works for the Home versions only.

    It looks like you don't have Personal Networks configured.  If you think you have, you must open a support ticket to get your account reviewed.

    0
    Comment actions Permalink
  • Avatar
    wtc.dan

    You are right.  Thank you, rotblitz.

    0
    Comment actions Permalink
  • Avatar
    rcarder

    I'm having the same issue as danjcarrington. When I first attempted to login, it just told me I didn't have access. I assumed this was because we had 2 step authentication on the account. Once I took two step authentication off it now says my password / username is incorrect. The only character in my password is a !. Any suggestions?

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    If you use your e-mail address as username, try with replacing the @ in your e-mail address by the %40 sequence.
    If you're invoking the script within a Windows command script, you must use %%40 instead.

    "we had 2 step authentication on the account."

    And again, this script cannot be used to fetch stats for the Enterprise (Umbrella) line of services, just for the Home services (free and VIP), because it is not supposted to work with the Umbrella dashboard at https://dashboard2.opendns.com/

    0
    Comment actions Permalink
  • Avatar
    rcarder

    Not sure how I looked over that... Thanks for the help

    0
    Comment actions Permalink
  • Avatar
    cbartens
    Any idea how to get the above to work with Google Sheets? Ie. run the scripts to import the data into a Google Sheet and then maybe schedule the import?
    0
    Comment actions Permalink
  • Avatar
    rotblitz

    The file you download is in CSV format.  If Google Sheets are capable of importing CSV data, you should be able to do this the normal way.  Help with Google Sheets is provided by Google, not by OpenDNS.

    0
    Comment actions Permalink
  • Avatar
    wrenhal

    For anyone that would like to know.  If you only want to retrieve blocked domains then you need to edit the "fetchstats.vbs" file.  You'll need to go towards the end of the file and make the following change:

    Change "/page"  to "/blocked/page"

    This will cut down on the amount of stats retrieved and narrow the system down to problem areas on your network.

    This helps me as I really only need to see what's being blocked.

    0
    Comment actions Permalink
  • Avatar
    wrenhal

    OK.  @rotblitz, I'm trying to run the windows command script you listed above.  It runs fine.  But if I place it in a task in Task Scheduler I can't seem to get it right.  It either says it's running forever and no window opens or I make adjustments to the task action and I get it to open a command window and runs and then leaves the window open and it has to be closed manually.  I'm in Windows 10 and here's how I have the action set right now:

    Action: Start Program

    Program/Script: cmd

    Arguments: start /c "" "C:\Users\T_Lma\Documents\OpenDNS stats\fetchstats_blocked.cmd"

    Start in: C:\Users\T_Lma\Documents\OpenDNS stats

    Anybody help me out here?

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    The problem may be that the Task Scheduler runs it under different credentials with different access rights.  You'll have to debug the script to see what's going on.

    Add this line at the begin on the script:  @set debug=Y

    Now change the command line in Scheduled Tasks to (one line):  

    cmd /c "C:\Users\T_Lma\Documents\OpenDNS stats\fetchstats_blocked.cmd" 1>C:\Users\T_Lma\Desktop\fetchstats.stdout.txt 2>C:\Users\T_Lma\Desktop\fetchstats.stderr.txt

    This produces two files fetchstats.std???.txt on your Desktop showing the execution of the script and hopefully where it gets stuck.

    0
    Comment actions Permalink
  • Avatar
    abdeldu65

    Hi, I'm also trying to use this script, but i get this error :

    C:\Users\xxxx\Desktop>cscript //NoLogo opends.vbs XXXXX@XXX networkID 2016-08-12
    Password: XXXX

    C:\Users\xxxx\Desktop\opends.vbs(16, 2) WinHttp.WinHttpRequest: Le délai imparti à l'opération est dépassé

    (from french : the timeout for the operation is reached)

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    It seems that WSH (Windows Scripting Host) is being blocked from reaching out to the internet, maybe by the built-in Windows firewall or by another firewall, e.g. your router or AV appliance.  You had to allow WSH to call out.

    0
    Comment actions Permalink
  • Avatar
    anauman49259

    I am trying to retrieve the history from my router. Was told the past year would be accessible. I've tried following the posts on here, but need clarification & more specific directions... I'm not very tech savvy. I am using Windows 10.

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    "I am trying to retrieve the history from my router."

    Does your router store history?  Whatever, the OpenDNS stats are not on your router but in the cloud on OpenDNS' servers.

    "Was told the past year would be accessible."

    This is only true with some paid versions of OpenDNS.  Which one do you use?

    "need clarification & more specific directions... "

    No problem, just ask your specific questions.

    0
    Comment actions Permalink
  • Avatar
    anauman49259

    "I am trying to retrieve the history from my router."

    Does your router store history?  Whatever, the OpenDNS stats are not on your router but in the cloud on OpenDNS' servers.

    **My router has several thousand "packets" stored on it.

    "Was told the past year would be accessible."

    This is only true with some paid versions of OpenDNS.  Which one do you use?

    ** I purchased the VIP plan.

    "need clarification & more specific directions... "

    No problem, just ask your specific questions.

    ** I have OpenDNS set up & connected to my network, but access the router history. How do I do that?

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    "My router has several thousand "packets" stored on it."

    Could be.  But this is unrelated to OpenDNS stats and the fetchstats tool.

    "I purchased the VIP plan."

    Yes, this comes with a year of stored stats.

    "I have OpenDNS set up & connected to my network, but access the router history. How do I do that?"

    I say it again, your router history has nothing to do with OpenDNS.  You must refer to your router support to see if you can access the "router history" and how.

    However, if you want to download your OpenDNS stats from OpenDNS' servers, you run the opendns-fetchstats script as lengthy explained in this thread before.  There's nothing to add to the instructions and explanations.

    0
    Comment actions Permalink
  • Avatar
    home-marsfield

    Hi

    I'm not an IT person. I'm simply trying to fetch using the CMD line, but keep getting the message "usage:<username> <network-id> <YYYY-MM-DD> [<YYYY-MM-DD>]"

    Any adia what i'm doing wrong? THis is what i've tried:

    I'v saved the fetchstats.vbs code in a file, named in "fetchstats.vbs" and saved in my working directory.

    I've saved the line "cscript //NoLogo fetchstats.vbs name@domain.com Network-ID 2017-01-03 2017-

    01-04/" in a file named "fetch.cmd" in my working directory and ran it from the working dierectory to get the above message. I've also tried changing the "@" in the user name to "%40" and "%%40" per some instructions above, but nothing works.

    Do i need to add my login details somehow?

    0
    Comment actions Permalink
  • Avatar
    rotblitz (Edited )

    "Do i need to add my login details somehow?"

    Well, the user name (e-mail address) is already a command parameter, and the VBS is supposed to prompt you for the password.  If you want to run it out of a command script (cmd), you better refer to my earlier example, where you can see that the password is piped into the VBS.

    Repeating it more readable:

    @rem  fetchstats.cmd              created by RotBlitz, April 2014
    @if not defined debug @echo off
    for /f "tokens=1-4 delims=/-. " %%G in ('date /t') do call :fixdate %%G %%H %%I %%J
    echo OpenDNS_Password|cscript //NoLogo fetchstats.vbs <username> <network-id> %@yy%-%@mm%-%@dd% > %@yy%%@mm%%@dd%.csv
    goto :EOF

    :fixdate
    if "%~1" GTR "9999" shift /1
    for /f "skip=1 tokens=2-4 delims=(-)" %%G IN ('echo.^|date') do (
    set @%%G=%1&set @%%H=%2&set @%%I=%3
    )
    goto :EOF

     The italic parts need to be edited by you.

    0
    Comment actions Permalink
  • Avatar
    netwrench

    Just a shout to rotblitz and the others who contributed to this thread; works great!

    For those not that familiar with vbscript - when you download the code from Github (beside stripping all the junk at the end), just make sure to save it as ansi from Notepad, or you'll get an unrecognized character error.

    Within the script as said above, you can select blocked or other reports.

    The next step is to setup the Splunk dashboard to make it easier to get a quick view of the data, and maybe to setup the scheduler. I think the scheduler probably would be best run the just before midnight, unless you changed the code to get the previous day's stats, and just run it the next morning.

    If I come up with anything of note, I'll post.

    0
    Comment actions Permalink
  • Avatar
    g2006y (Edited )

    Just noticed today that fetchstat login doesn't seem to work anymore, I guess has to do with the new login page "look", although the URLs seems to be the same.

    Message I get is "Login Failed. Check username and password". Using @ or %40 or %%40 all the same.

    Logging through usual web interface works ok though, so it's not an account name/password problem.

    0
    Comment actions Permalink
  • Avatar
    netwrench

    Hey g2006y,

    Great catch and easy fix:

    Comment or delete this line (single quote is a comment)

    ' regEx.Pattern = ".*Logging you in.*"

    Change it to this (they just changed the word, but there could be some error or other conditions this fix could miss, but it works)
    regEx.Pattern = ".*Login*"

    Back in business.  I had just setup my scheduler to work starting 7/30, and they updated the page so 7/31 failed, but I hadn't checked to see if it was running (it was a busy week).  I see now I need to set some logging within the script(s).

    Cheers,

    Netwrench

    2
    Comment actions Permalink
  • Avatar
    g2006y

    Aaah! Yeeees! Thanks, that works!

    0
    Comment actions Permalink
  • Avatar
    ashbyc

    Still getting "Login Failed" using 

    I changed the URL string as below, but still isn't working?  This was taken from above thinking it was also my issue...

            "$LOGINURL" \
            | grep "*Login*"

    Any thoughts?  Using the shell script...

    0
    Comment actions Permalink
  • Avatar
    g2006y (Edited )

    the regex is

    ".*Login.*"

    2
    Comment actions Permalink
  • Avatar
    rroach78 (Edited )

    In the same boat as ashbyc - using the shell script & getting "Login Failed" message due to the OpenDNS login page changes.

     

    # Sign into OpenDNS
    SIGNIN=`curl --silent --insecure \
    --cookie "$COOKIEJAR" \
    --cookie-jar "$COOKIEJAR" \
    --data "formtoken=$FORMTOKEN&username=$USERNAME&password=$PASSWORD&sign_in_submit=foo" \
    "$LOGINURL" \
    | grep "*Login*"
    `

     

    Appreciate any recommendations, thanks!

    -1
    Comment actions Permalink
  • Avatar
    rotblitz (Edited )

    Bad eyes or not willing to read? :(

    Again, the regex is ".*Login.*", as said in the comment before yours.

    0
    Comment actions Permalink
  • Avatar
    rroach78

    Apologies rotblitz, thought that response was for VBS only. I tried ".*Login.*" but received the same error - Login Failed.

    0
    Comment actions Permalink
  • Avatar
    ashbyc

    rroach78 - instead of using email@domain.com use email%40domain.com for login -- this and the regex is what I needed to change for this to work.

    1
    Comment actions Permalink
  • Avatar
    rroach78

    Just now had a chance to sit down & try to get this working. I feel like I'm close but not there yet. I've made changes to both the regex as well as replacing @ with %40 in the email address. Now instead of the login failed error, I get a message that reads "You can not access all". When I try to use my 6-digit ID instead of all, I get the same message with my ID.

     

    Are there any other recommendations that I might be able to try? Thanks!

    0
    Comment actions Permalink

Please sign in to leave a comment.