<commit_before>//
//  ECShodanClient.h
//  Erran Carey
//
//  Created by <NAME> on 1/4/14.
//  Copyright (c) 2012-2014 <NAME>. All rights reserved.
//

#import <Foundation/Foundation.h>

#pragma mark ECShodanClient
#pragma mark -

/**
 A ECShodanClient object interfaces with the ShodanHQ site.
 */
@interface ECShodanClient : NSObject

#pragma mark -
#pragma mark Properties
#pragma mark -

/**
 The API key to use as the 'key' parameter.
 */
@property (strong, nonatomic) NSString *apiKey;

/**
 The base URL to send web requests to

 [todo] - Use a constant instead
 [review] - If a constant is used, how will testing work?
 */
@property (strong, nonatomic) NSString *baseURL;

/**
 Stores the JSON results form the Shodan API.
 */
@property (strong, nonatomic) NSDictionary *results;

/**
 A dictionary to store request parameters
 */
@property (strong, nonatomic) NSDictionary *requestParameters;

/**
 The request paremeters compiled as a query string.
 */
@property (strong, nonatomic) NSString *queryString;

#pragma mark -
#pragma mark Session Management Methods
#pragma mark -

/**
 @param key The API key to initalize the API object with.
 @return ECShodanClient
 */
- (id)initWithAPIKey:(NSString *)key;

/**
 @param key The API key to initalize the API object with.
 */
- (void)setAPIKey:(NSString *)key;

#pragma mark -
#pragma mark Other Methods
#pragma mark -

/**
 Sends a request to ShodanHQ based on the function.

 @param function The type of request to send to ShodanHQ.
 */
- (void)request:(NSString *)function;

#pragma mark -
#pragma mark Search API Methods
#pragma mark -

/**
 Retrieves the count of results for a given query.

 [todo] - Fix the @return value.

 @param query The query to request a count for.
 @return A NSDictionary with the count as the first value.
 */
- (NSDictionary *)count:(NSString *)query;

/**
 Get all the available information on a host in the SHODAN database

 @param hostname The ip of a host to lookup.
 @return A NSDictionary with the keys: "ip", "longitude", "latitude", "hostnames", "country_code", "country", "country_name", and "data".
 */
- (NSDictionary *)host:(NSString *)hostname;

/**
 Return a list of the countries and cities found for a given search query.

 @param query The query to retrieve location information for.
 @return A NSDictionary with the keys: "cities" and "countries".
 */
- (NSDictionary *)locations:(NSString *)query;

/**
 Search the SHODAN database.

 @param query The query to search ShodanHQ for.
 @return A NSDictionary with the keys: "cities", "countries", "matches", and "total".
 @see method search:page:limit:offset:
 */
- (NSDictionary *)search:(NSString *)query;

/**
 Search the SHODAN database.

 @param query The query to search ShodanHQ for.
 @param pageNumber The page number for results.
 @return A NSDictionary with the keys: "cities", "countries", "matches", and "total".
 @see method search:page:limit:offset:
 */
- (NSDictionary *)search:(NSString *)query
                    page:(int)pageNumber;

/**
 Search the SHODAN database.

 @param query The query to search ShodanHQ for.
 @param pageNumber The page number for results.
 @param perPage The results to display per page.
 @return A NSDictionary with the keys: "cities", "countries", "matches", and "total".
 @see method search:page:limit:offset:
 */
- (NSDictionary *)search:(NSString *)query
                    page:(int)pageNumber
                   limit:(int)perPage;

/**
 Search the SHODAN database.

 @param query The query to search ShodanHQ for.
 @param pageNumber The page number for results.
 @param perPage The results to display per page.
 @param pageOffset The result number to begin searching from.
 @return A NSDictionary with the keys: "cities", "countries", "matches", and "total".
 @see method search:page:limit:offset:
 */
- (NSDictionary *)search:(NSString *)query
                    page:(int)pageNumber
                   limit:(int)perPage
                  offset:(int)pageOffset;

#pragma mark -
#pragma mark Other API Methods
#pragma mark -

/**
 View the current API key's plan, add-ons, and credits.

 @return A NSDictionary with the keys: "unlocked_left", "telnet", "plan", "https", and "unlocked".
 */
- (NSDictionary *)info;

@end<commit_msg>Use @name vs. #pragma mark in interface<commit_after>//
//  ECShodanClient.h
//  Erran Carey
//
//  Created by <NAME> on 1/4/14.
//  Copyright (c) 2012-2014 <NAME>. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 A ECShodanClient object interfaces with the ShodanHQ site.
 */
@interface ECShodanClient : NSObject

///-----------------
/// @name Properties
///-----------------

/**
 The API key to use as the 'key' parameter.
 */
@property (strong, nonatomic) NSString *apiKey;

/**
 The base URL to send web requests to

 [todo] - Use a constant instead
 [review] - If a constant is used, how will testing work?
 */
@property (strong, nonatomic) NSString *baseURL;

/**
 Stores the JSON results form the Shodan API.
 */
@property (strong, nonatomic) NSDictionary *results;

/**
 A dictionary to store request parameters
 */
@property (strong, nonatomic) NSDictionary *requestParameters;

/**
 The request paremeters compiled as a query string.
 */
@property (strong, nonatomic) NSString *queryString;

///---------------------------------
/// @name Session Management Methods
///---------------------------------

/**
 @param key The API key to initalize the API object with.
 @return ECShodanClient
 */
- (id)initWithAPIKey:(NSString *)key;

/**
 @param key The API key to initalize the API object with.
 */
- (void)setAPIKey:(NSString *)key;

///--------------
/// Other Methods
///--------------

/**
 Sends a request to ShodanHQ based on the function.

 @param function The type of request to send to ShodanHQ.
 */
- (void)request:(NSString *)function;

///-------------------
/// Search API Methods
///-------------------

/**
 Retrieves the count of results for a given query.

 [todo] - Fix the @return value.

 @param query The query to request a count for.
 @return A NSDictionary with the count as the first value.
 */
- (NSDictionary *)count:(NSString *)query;

/**
 Get all the available information on a host in the SHODAN database

 @param hostname The ip of a host to lookup.
 @return A NSDictionary with the keys: "ip", "longitude", "latitude", "hostnames", "country_code", "country", "country_name", and "data".
 */
- (NSDictionary *)host:(NSString *)hostname;

/**
 Return a list of the countries and cities found for a given search query.

 @param query The query to retrieve location information for.
 @return A NSDictionary with the keys: "cities" and "countries".
 */
- (NSDictionary *)locations:(NSString *)query;

/**
 Search the SHODAN database.

 @param query The query to search ShodanHQ for.
 @return A NSDictionary with the keys: "cities", "countries", "matches", and "total".
 @see method search:page:limit:offset:
 */
- (NSDictionary *)search:(NSString *)query;

/**
 Search the SHODAN database.

 @param query The query to search ShodanHQ for.
 @param pageNumber The page number for results.
 @return A NSDictionary with the keys: "cities", "countries", "matches", and "total".
 @see method search:page:limit:offset:
 */
- (NSDictionary *)search:(NSString *)query
                    page:(int)pageNumber;

/**
 Search the SHODAN database.

 @param query The query to search ShodanHQ for.
 @param pageNumber The page number for results.
 @param perPage The results to display per page.
 @return A NSDictionary with the keys: "cities", "countries", "matches", and "total".
 @see method search:page:limit:offset:
 */
- (NSDictionary *)search:(NSString *)query
                    page:(int)pageNumber
                   limit:(int)perPage;

/**
 Search the SHODAN database.

 @param query The query to search ShodanHQ for.
 @param pageNumber The page number for results.
 @param perPage The results to display per page.
 @param pageOffset The result number to begin searching from.
 @return A NSDictionary with the keys: "cities", "countries", "matches", and "total".
 @see method search:page:limit:offset:
 */
- (NSDictionary *)search:(NSString *)query
                    page:(int)pageNumber
                   limit:(int)perPage
                  offset:(int)pageOffset;

///------------------
/// Other API Methods
///------------------

/**
 View the current API key's plan, add-ons, and credits.

 @return A NSDictionary with the keys: "unlocked_left", "telnet", "plan", "https", and "unlocked".
 */
- (NSDictionary *)info;

@end
{'fraction_non_alphanumeric': 0.1395567022399437, 'fraction_numerical': 0.0028145889527383607, 'mean_word_length': 3.1886051080550097, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2989894', 'n_tokens_mistral': 2571, 'n_tokens_neox': 2428, 'n_words': 984}