Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box Static download links. #50

Closed
KuroSaru opened this issue Oct 10, 2016 · 19 comments
Closed

Box Static download links. #50

KuroSaru opened this issue Oct 10, 2016 · 19 comments
Assignees

Comments

@KuroSaru
Copy link

Would it be possible to provide static direct download links along with the current ones, so that it be possible to parse the csv/json on new pushes and auto grab pdfs as they are added to the list.

@kbandla kbandla self-assigned this Oct 10, 2016
@kbandla
Copy link
Member

kbandla commented Oct 10, 2016

This should not be this difficult. I will look into making this easier for everyone. @Taskr 's solution should work in the interim.

@ghost
Copy link

ghost commented Nov 4, 2016

possible solution: https://docs.box.com/reference#create-a-shared-link-for-a-file -- we could just gen the share link and public static link for the json and csvs

@pedrodj
Copy link

pedrodj commented Nov 8, 2016

SyntaxError: Non-ASCII character '\xe2' in file C:\autodownload.py on line
49, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for deta
ils

Any help?

@threatminer
Copy link

threatminer commented Nov 8, 2016

Add this to the top of the script:

# -*- coding: UTF-8 -*-

The top should look like this:

#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import os
import hashlib
import json
import requests
from bs4 import BeautifulSoup

@pedrodj
Copy link

pedrodj commented Nov 8, 2016

Is it possible to have autodownload.py that works? :)

Thank you ;)

@threatminer
Copy link

Here's the script with the changes I just recommended...

autodownload.py.txt

@pedrodj
Copy link

pedrodj commented Nov 8, 2016

Traceback (most recent call last):
File "C:\autodownload.py", line 6, in
import requests
ImportError: No module named requests

@threatminer
Copy link

That's not an error with the code - you just need to install the 'requests' module.

pip install requests or easy_install requests

@cgi1
Copy link

cgi1 commented Jun 27, 2017

Is someone still using the script provided by @Taskr ?

[!] Download failure for FireEye_Cyber-Espionage-Alive-Well-APT32(05-14-2017) 'NoneType' object is not subscriptable
[!] Download failure for GovCERTch_Report_Ruag_Espionage_Case(5-23-16) [Errno 54] Cannot connect to host app.box.com:443 ssl:True [Can not connect to app.box.com:443 [Connect call failed ('107.152.26.198', 443)]]
[!] Download failure for RecordedFuture_Chinese-Ministry-State-APT3(05-17-2017) 'NoneType' object is not subscriptable
[!] Download failure for Kaspersky_Lazarus-Under-The-Hood-PDF_final(04-03-2017) 'NoneType' object is not subscriptable
[!] Download failure for FireEye_APT28-Center-of-Storm(01-11-2017) 'NoneType' object is not subscriptable
[!] Download failure for PaloAlto_The-Blockbuster-Sequel(04-07-2017) 'NoneType' object is not subscriptable
[!] Download failure for kingslayer-a-supply-chain-attack(02-03-2017) 'NoneType' object is not subscriptable
[!] Download failure for Badcyber_Polish-banks-hacked-information-stolen-unknown-attackers(02-03-2017) 'NoneType' object is not subscriptable
[!] Download failure for UnitedStates_-Senate_Committee_-on_Armed_Services-Clapper-Lettre-Rogers(01-05-2017) 'NoneType' object is not subscriptable
[!] Download failure for tr1adx_Bear-Hunting-APT28-Tracking(12-28-2016) 'NoneType' object is not subscriptable
[!] Download failure for Microsoft_Targeted-attacks-in-South-and-Southeast-Asia(Apr-26-16) 'NoneType' object is not subscriptable
[!] Download failure for tr1adx_Dope-Story-Bears(01-14-2017) 'NoneType' object is not subscriptable
[!] Download failure for USCERT_GRIZZLY STEPPE(12-29-2016) 'NoneType' object is not subscriptable
[!] Download failure for Clearsky_Iranian-OilRig-Delivers-Signed-Oxford(01-05-2017) 'NoneType' object is not subscriptable
[!] Download failure for Microsoft_SIR-Vol21-PROMETHIUM-NEODYMIUM-Updated(12-14-2016) 'NoneType' object is not subscriptable
[!] Download failure for ESET_Carbanak-packing-new-guns(09-08-2015) 'NoneType' object is not subscriptable
[!] Download failure for Duke_cloud_Linux 'NoneType' object is not subscriptable

@ghost
Copy link

ghost commented Jul 7, 2017

I dont use the provided download script but i wrote my own.

Recently the box homepage changed a little. If you check out the source code for this example
"https://app.box.com/s/740pmk3f6nrhfbj9nmcvovc64oah2ibi" which corresponds to report 449 "ESET_TeleBots-Supply-chain-attacks-against-Ukraine(06-30-2017).pdf", you can see that the file_id changed from "data-file-id" to "data-typed-id".

image

I havent confirmed this with the script that @Taskr provided but with mine it worked. In the script it should be enough to change the following lines:

image

OLD:
file_id = soup.body.find("div", class_="preview")['data-file-id']
box_args = "?rm=box_download_shared_file&shared_name={}&file_id=f_{}"

NEW:
file_id = soup.body.find("div", class_="preview")['data-typed-id']
box_args = "?rm=box_download_shared_file&shared_name={}&file_id={}"

Hope this helps.

@Taskr
Copy link

Taskr commented Jul 7, 2017

I updated the scripts for the new structure. I had to make some additional adjustments based on @jenter8 suggestions. Thanks for bringing this to my attention, sorry about the long delay @cgi1 @jenter8 :)

@cgi1
Copy link

cgi1 commented Jul 7, 2017

@Taskr: Nice - Its working!

@Taskr
Copy link

Taskr commented Oct 19, 2017

Updated to work again.

Synchronous Download Script (Python 2.7+):
APTnotes_sync_download.py.txt

Asynchronous Download Script (Python 3.4+):
APTnotes_async_download_python34.py.txt

Asynchronous Download Script (Python 3.5+):
APTnotes_async_download_python35.py.txt

Synchronous Download Script Requirements:
APTnotes_sync_requirements.txt

Asynchronous Download Scripts Requirements:
APTnotes_async_requirements.txt

@ghost
Copy link

ghost commented Oct 30, 2017

report_filename = report['Filename'] + '.pdf'
for better experience :)

@Taskr
Copy link

Taskr commented Nov 2, 2017

Updated the synchronous script to reflect the improved experience (asynchronous scripts already added .pdf extension)

Thanks @KiUserExceptionDispatcher :)

@MartinIngesen
Copy link

May I suggest adding this as a project under https://github.com/aptnotes/tools so that we can participate in the development of this downloader?

@ghost
Copy link

ghost commented Feb 2, 2018

Cheers, Ill get this added over the weekend @MartinIngesen

@ghost ghost self-assigned this Feb 2, 2018
ghost pushed a commit to aptnotes/tools that referenced this issue Feb 4, 2018
@ghost
Copy link

ghost commented Feb 4, 2018

@ghost
Copy link

ghost commented Feb 4, 2018

closing out the issue as scripts have been added to the repo

@ghost ghost closed this as completed Feb 4, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants