Class AssemblylineClient


  • public class AssemblylineClient
    extends Object
    • Method Detail

      • withAuthBearerToken

        public AssemblylineClient withAuthBearerToken​(String authBearerToken)
        Creates a copy of the current AssemblylineClient that will use the given authentication bearer token.
        Parameters:
        authBearerToken - The authentication bearer token for the new client to use.
        Returns:
        the new client.
      • login

        public reactor.core.publisher.Mono<LoginResponse> login()
      • isSubmissionComplete

        public reactor.core.publisher.Mono<Boolean> isSubmissionComplete​(String sid)
      • getFileInfo

        public reactor.core.publisher.Mono<FileInfo> getFileInfo​(String sha256)
      • getFileResults

        public reactor.core.publisher.Mono<FileResults> getFileResults​(String sha256)
      • getResult

        public reactor.core.publisher.Mono<ResultBlock> getResult​(String cacheKey)
      • getSubmissionTree

        public reactor.core.publisher.Mono<SubmissionTree> getSubmissionTree​(String sid)
      • getSubmission

        public reactor.core.publisher.Mono<Submission> getSubmission​(String sid)
      • getSubmissionFull

        public reactor.core.publisher.Mono<SubmissionFull> getSubmissionFull​(String sid)
      • getHashSearchDataSources

        public reactor.core.publisher.Mono<List<String>> getHashSearchDataSources()
      • hashSearch

        public reactor.core.publisher.Mono<Map<String,​HashSearchResult>> hashSearch​(String fileHash,
                                                                                          List<String> dataSources,
                                                                                          Integer maxTimeout)
        Search for a hash in multiple data sources.
        Parameters:
        fileHash - Hash to search in the multiple data sources (MD5, SHA1 or SHA256)
        dataSources - list of data sources. Set to null to use server default.
        maxTimeout - Maximum execution time for the call in seconds. Set to null to use server default.
        Returns:
        Search results
        See Also:
        hashSearch(String)
      • hashSearch

        public reactor.core.publisher.Mono<Map<String,​HashSearchResult>> hashSearch​(String fileHash)
        Search for a hash in multiple data sources, using default values for optional parameters.
        Parameters:
        fileHash - Hash to search in the multiple data sources (MD5, SHA1 or SHA256)
        Returns:
        Search results
        See Also:
        hashSearch(String, List, Integer)
      • setSession

        protected void setSession​(org.springframework.web.reactive.function.client.ClientResponse clientResponse)
      • retryWrapper

        protected <T> reactor.core.publisher.Mono<T> retryWrapper​(reactor.core.publisher.Mono<T> monoContent)
      • get

        protected <T> reactor.core.publisher.Mono<T> get​(Function<org.springframework.web.util.UriBuilder,​URI> uriBuilder,
                                                         org.springframework.core.ParameterizedTypeReference<AssemblylineApiResponse<T>> responseType)
        Helper method to perform a JSON GET request. This helper covers the most common GET requests. For more specialized requests, use webClient directly.
        Type Parameters:
        T - The type of data that will be in the response.
        Parameters:
        uriBuilder - UriBuilder that will generate the URI to GET.
        responseType - A parameterized type reference representing the type of data that will be in the response. The declaration of this object must only include concrete type parameters. For example, new ParameterizedTypeReference<ALApiResponse<Boolean>> is OK, but new ParameterizedTypeReference<ALApiResponse<T>> (where T is a type parameter on a method) is not OK.
        Returns:
        The content of the "api_response" section of the response.
      • post

        protected <T> reactor.core.publisher.Mono<T> post​(Function<org.springframework.web.util.UriBuilder,​URI> uriBuilder,
                                                          org.springframework.core.ParameterizedTypeReference<AssemblylineApiResponse<T>> responseType,
                                                          org.springframework.web.reactive.function.BodyInserter<?,​? super org.springframework.http.client.reactive.ClientHttpRequest> bodyInserter,
                                                          org.springframework.http.MediaType contentType)
        Helper method to perform a JSON POST request. This helper covers the most common POST requests. For more specialized requests, use webClient directly.
        Type Parameters:
        T - The type of data that will be in the response.
        Parameters:
        uriBuilder - UriBuilder that will generate the URI to POST.
        responseType - A parameterized type reference representing the type of data that will be in the response. The declaration of this object must only include concrete type parameters. For example, new ParameterizedTypeReference<ALApiResponse<Boolean>> is OK, but new ParameterizedTypeReference<ALApiResponse<T>> (where T is a type parameter on a method) is not OK.
        bodyInserter - BodyInserter to construct the body of the Post Request
        contentType - MediaType of the request body
        Returns:
        The content of the "api_response" section of the response.
      • clientResponseToMono

        protected <T> reactor.core.publisher.Mono<T> clientResponseToMono​(org.springframework.web.reactive.function.client.ClientResponse clientResponse,
                                                                          org.springframework.core.ParameterizedTypeReference<AssemblylineApiResponse<T>> type)
        Convert ClientResponse to AssemblylineApiResponse content mono.

        Type Parameters:
        T - The type of data that will be in the response.
        Parameters:
        clientResponse - ClientResponse returned by call
        type - A parameterized type reference representing the type of data that will be in the response. The declaration of this object must only include concrete type parameters. For example, new ParameterizedTypeReference<ALApiResponse<Boolean>> is OK, but new ParameterizedTypeReference<ALApiResponse<T>> (where T is a type parameter on a method) is not OK.
        Returns:
        Mono