ata_phantomjs is a Node.js based image to obtain screenshot of a given URL
5.7K
ata_phantomjs is a Node.js app meant to mirror and extend the functionality of the ata_webkit2png app.
If you don't understand this, please talk to me so you can understand this.
grunt live works finesettings.js to point to docker (Assuming docker resolves to your localhost)docker-compose up -d --build && docker-compose -f logstest.py which does the same thing as what happens in productionYou should see images in the /opt/images directory which will be mapped to your local ./tmp
Clone the repo and run docker-compose up to build the image and start up the container. Port 8080 is exposed for the API which can be reached here:
If you set up this container locally, you might want to test reports generation functionality on ata_portal project.
Issue desciption:
Automated making of page screenshots can fail locally with strange error: "Could not capture image" text inside of output file instead of actual image content.
This happens if PhantomJS is not able to open localhost URL from within a container.
How to fix:
Add such string to the bottom to your docker-compose.yml file:
network_mode: "host"
Then rebuild and rerun a container to allow connection to the host.
Capture any given web page as an image.
{
url: [URL of page to capture], # required
dimensions: ['<width>x<height>'|'<width>'|'auto'], # required
wait: [time in seconds to wait before capturing image], # default: 200 ms
scale: [scaling, e.g., 1 (for 1x), 2 (for 2x - Retina), etc.], # default: 1
elem: [DOM selector ID of element to capture] # default: null
}
import requests
url = 'http://localhost:8080/'
resp = requests.post(url=url, json={
'url': 'https://www.google.com/search?source=hp&q=hp',
'dimensions': '1200x800',
'wait': 2,
'scale': 2,
'elem': 'hplogo'
})
Test whether service is up and running.
import requests
url = 'http://localhost:8080/ping'
resp = requests.post(url=url, json={})
resp.json()['status'] == 'ok'
Content type
Image
Digest
Size
396.3 MB
Last updated
over 7 years ago
docker pull advancedthreatanalytics/ata_phantomjs