mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-02-12 16:12:44 +00:00
fix mitm page should not be available when campaign closed
Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
@@ -192,6 +192,14 @@ func (m *ProxyHandler) HandleHTTPRequest(w http.ResponseWriter, req *http.Reques
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if context is nil, campaign is not active - return 404
|
||||
if reqCtx == nil {
|
||||
return m.writeResponse(w, &http.Response{
|
||||
StatusCode: http.StatusNotFound,
|
||||
Header: make(http.Header),
|
||||
Body: io.NopCloser(strings.NewReader("")),
|
||||
})
|
||||
}
|
||||
|
||||
// check for URL rewrite and redirect if needed
|
||||
if rewriteResp := m.checkAndApplyURLRewrite(req, reqCtx); rewriteResp != nil {
|
||||
@@ -337,6 +345,15 @@ func (m *ProxyHandler) initializeRequestContext(ctx context.Context, req *http.R
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("failed to get campaign: %w", err)
|
||||
}
|
||||
|
||||
// check if campaign is active
|
||||
if !campaign.IsActive() {
|
||||
m.logger.Debugw("campaign is not active",
|
||||
"campaignID", campaignID.String(),
|
||||
)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
reqCtx.Campaign = campaign
|
||||
|
||||
// preload campaign template if available
|
||||
@@ -602,6 +619,15 @@ func (m *ProxyHandler) resolveSessionContext(req *http.Request, reqCtx *RequestC
|
||||
reqCtx.CampaignID = session.CampaignID
|
||||
reqCtx.CampaignRecipientID = session.CampaignRecipientID
|
||||
reqCtx.RecipientID = session.RecipientID
|
||||
|
||||
// check if campaign is still active
|
||||
if !session.Campaign.IsActive() {
|
||||
m.logger.Debugw("session campaign is no longer active",
|
||||
"sessionID", reqCtx.SessionID,
|
||||
"campaignID", session.CampaignID.String(),
|
||||
)
|
||||
return fmt.Errorf("campaign is no longer active")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user