khast3x/h8mail

Intelx: 401 Unauthorized when using academia upgraded API key

Kleissner opened this issue ยท 4 comments

Env

  • h8mail version: Latest

Description

The bucket leaks.private is hard-coded on this line, but that bucket may not be available to all API keys:

buckets=["leaks.public", "leaks.private", "pastes", "darknet.tor"],

Solution: Since a few lines earlier, you are getting the API key limits (including authorized buckets), you could use that to add "leaks.private" if it appears:

    cap = intelx.GET_CAPABILITIES()
    # print(cap["buckets"])

Something like (dummy code):

buckets=["leaks.public", "pastes", "darknet.tor"]
if array_contains(cap["buckets"], "leaks.private") {
  buckets = append(buckets, "leaks.private")
}
...
    search = intelx.search(
        target,
        buckets=buckets,
        maxresults=maxfile,
        media=24,
    )

Hello,

Thank you for opening the issue. What buckets does the upgraded academia key provide?
It will take some time before I release an update but I'll make sure to include this.

Cheers

As written above it would make the most sense to check cap["buckets"] to see which buckets the user has access to.
The exact list of allowed buckets for the academia license might change in the future, and actually right now it is being changed to include preview access to "leaks.private" (which means for now this issue is resolved and can be closed).

But to be future proof (for any license) it makes sense to check what cap = intelx.GET_CAPABILITIES() returns and only specify buckets that the user is actually authorized.

That is what I meant when I wrote that it will be included in a future update. I'll keep this issue opened for tracking.
Cheers

Hey there,

The issue should be solved in the next update using this. Let me know if you need any further modifications ๐Ÿ‘

Cheers