Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DCSG2900-ThreatTotal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johannes Barstad
DCSG2900-ThreatTotal
Commits
98dec9f3
Commit
98dec9f3
authored
3 years ago
by
Odin K. Henriksen
Browse files
Options
Downloads
Patches
Plain Diff
Stops the program from breaking if the URL or Domain does not exist
parent
c2c0228a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/screenShot.go
+4
-2
4 additions, 2 deletions
utils/screenShot.go
with
4 additions
and
2 deletions
utils/screenShot.go
+
4
−
2
View file @
98dec9f3
...
@@ -2,9 +2,10 @@ package utils
...
@@ -2,9 +2,10 @@ package utils
import
(
import
(
"context"
"context"
"fmt"
"log"
"log"
"strings"
"strings"
logging
"dcsg2900-threattotal/logs"
"github.com/chromedp/chromedp"
"github.com/chromedp/chromedp"
)
)
...
@@ -35,7 +36,8 @@ func ScreenshotURL(url string, Response *ResultFrontendResponse) {
...
@@ -35,7 +36,8 @@ func ScreenshotURL(url string, Response *ResultFrontendResponse) {
// Take the screenshot using the screenScreenshot function
// Take the screenshot using the screenScreenshot function
if
err
:=
chromedp
.
Run
(
ctx
,
screenScreenshot
(
SearchURL
,
&
screenshotbuf
));
err
!=
nil
{
if
err
:=
chromedp
.
Run
(
ctx
,
screenScreenshot
(
SearchURL
,
&
screenshotbuf
));
err
!=
nil
{
log
.
Fatal
(
err
)
fmt
.
Println
(
"This URL or Domain can not be accessed."
)
logging
.
Logerror
(
err
,
"Page could not be loaded, URL or domain does not exist."
)
}
}
log
.
Printf
(
"Took a screenshot of a request url"
)
log
.
Printf
(
"Took a screenshot of a request url"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment