|
1 | | -# xcode |
2 | | -xCode helper framework to access Antideo's RETS API |
| 1 | +[](https://raw.githubusercontent.com/PanPanayotov/antideo-xcode/master/LICENSE) |
| 2 | +[](https://github.com/Carthage/Carthage) |
| 3 | + |
| 4 | +This is xcode framework created to help developers when using [Antideo's REST API](http://antideo.com). |
| 5 | +Antideo helps locating IP adresses, performs reputation (health) checks on both IP and email addresses. |
| 6 | + |
| 7 | +Please consult this [API Documentation](http://antideo.com/documentation) for up to date information on endpoints. |
| 8 | + |
| 9 | +# Installation |
| 10 | + |
| 11 | +## Carthage |
| 12 | +``` |
| 13 | +github "antideo/xcode" |
| 14 | +``` |
| 15 | +## How to use |
| 16 | +First import the framework. |
| 17 | +``` swift |
| 18 | +import Antideo |
| 19 | +``` |
| 20 | + |
| 21 | +Main helper class is called ``AAHelper`` from ``Antideo Application Helper`` and here is how to use it. |
| 22 | + |
| 23 | +### Get IP info |
| 24 | +``` swift |
| 25 | +AAHelper.getIPInfo("1.2.3.4") { (result, error) in |
| 26 | + /* |
| 27 | + * IP address queried |
| 28 | + */ |
| 29 | + result?.ip // -> @optional String |
| 30 | + |
| 31 | + /* |
| 32 | + * Hostname for IP address |
| 33 | + */ |
| 34 | + result?.host // -> @optional String |
| 35 | + |
| 36 | + /* |
| 37 | + * ASN Organisation's name |
| 38 | + */ |
| 39 | + result?.orgName // -> @optional String |
| 40 | + |
| 41 | + /* |
| 42 | + * ASN (autonomous system number) |
| 43 | + */ |
| 44 | + result?.asn // -> @optional String |
| 45 | + |
| 46 | + /* |
| 47 | + * Date this ASN was assigned to the organisation |
| 48 | + */ |
| 49 | + result?.asnAssigned // -> @optional NSDate |
| 50 | + |
| 51 | + /* |
| 52 | + * The origination country of the organisation |
| 53 | + */ |
| 54 | + result?.country // -> @optional String |
| 55 | + |
| 56 | + /* |
| 57 | + * Issuing registry |
| 58 | + */ |
| 59 | + result?.registry // -> @optional String |
| 60 | + |
| 61 | + /* |
| 62 | + * Organisation category |
| 63 | + */ |
| 64 | + result?.category // -> @optional String |
| 65 | +} |
| 66 | +``` |
| 67 | +#### Available IP address categories |
| 68 | +* hosting |
| 69 | +* education |
| 70 | +* bank |
| 71 | +* mobile |
| 72 | +* government |
| 73 | +* undefined |
| 74 | + |
| 75 | +Please refer to [IPInfoResult](https://github.com/antideo/xcode/blob/master/Antideo/IPInfoResult.h) class for full and up-to-date property list. |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | +### Get IP location |
| 80 | +``` swift |
| 81 | +AAHelper.getIPLocation("1.2.3.4") { (result, error) in |
| 82 | + /* |
| 83 | + * IP address for the location result |
| 84 | + */ |
| 85 | + result?.ip // -> @optional String |
| 86 | + |
| 87 | + /* |
| 88 | + * Latitude value from the Geolocation |
| 89 | + */ |
| 90 | + result?.latitude // -> @optional Number |
| 91 | + |
| 92 | + /* |
| 93 | + * Longitude value from the Geolocation |
| 94 | + */ |
| 95 | + result?.longitude // -> @optional Number |
| 96 | + |
| 97 | + /* |
| 98 | + * Accuracy level of returned location |
| 99 | + * Number between 0 and 1000 |
| 100 | + */ |
| 101 | + result?.accuracy // -> @optional Number |
| 102 | + |
| 103 | + /* |
| 104 | + * City of IP address |
| 105 | + */ |
| 106 | + result?.city // -> @optional String |
| 107 | + |
| 108 | + /* |
| 109 | + * Region of IP address |
| 110 | + */ |
| 111 | + result?.region // -> @optional String |
| 112 | + |
| 113 | + /* |
| 114 | + * Country of IP address |
| 115 | + */ |
| 116 | + result?.country // -> @optional String |
| 117 | + |
| 118 | + /* |
| 119 | + * Two letter ISO country code. Example: US (United States) or IE (Ireland) |
| 120 | + */ |
| 121 | + result?.countryCode // -> @optional String |
| 122 | +} |
| 123 | +``` |
| 124 | +Please refer to [IPLocationResult](https://github.com/antideo/xcode/blob/master/Antideo/IPLocationResult.h) class for full and up-to-date property list. |
| 125 | + |
| 126 | +### Get IP health result |
| 127 | +``` swift |
| 128 | +AAHelper.getIPHealth("1.2.3.4") { (result, error) in |
| 129 | + /* |
| 130 | + * IP address for the health result |
| 131 | + */ |
| 132 | + result?.ip // -> @optional String |
| 133 | + |
| 134 | + /* |
| 135 | + * Indicates if IP is part of infected/hacked network, or |
| 136 | + * is beeing used for ssh/brute force attacks etc. |
| 137 | + */ |
| 138 | + result?.toxic // -> @optional Bool |
| 139 | + |
| 140 | + /* |
| 141 | + * Holds proxy result values if clasified as proxy |
| 142 | + */ |
| 143 | + result?.proxy // -> @optional AAProxyResult |
| 144 | + |
| 145 | + /* |
| 146 | + * Holds spam result values if there is spam reports agains it. |
| 147 | + */ |
| 148 | + result?.spam // -> @optional AAReportResult |
| 149 | +} |
| 150 | +``` |
| 151 | +Please refer to [IPLocationResult](https://github.com/antideo/xcode/blob/master/Antideo/IPLocationResult.h) class for full and up-to-date property list. |
| 152 | +See also |
| 153 | +* [AAProxyResult](https://github.com/antideo/xcode/blob/master/Antideo/AAProxyResult.h) |
| 154 | +* [AAReportResult](https://github.com/antideo/xcode/blob/master/Antideo/AAReportResult.h) |
| 155 | + |
| 156 | +### Get email info |
| 157 | +``` swift |
| 158 | +AAHelper. getEmailInfo( "[email protected]") { (result, error) in |
| 159 | + /* |
| 160 | + * Email address for the info result |
| 161 | + */ |
| 162 | + result?.email // -> @optional String |
| 163 | + |
| 164 | + /* |
| 165 | + * Indicates if email is from a free provider like GMail etc. |
| 166 | + */ |
| 167 | + result?.freeProvider // -> @optional Bool |
| 168 | + |
| 169 | + /* |
| 170 | + * Indicates if email is disposable/temporary |
| 171 | + */ |
| 172 | + result?.disposable // -> @optional Bool |
| 173 | + |
| 174 | + /* |
| 175 | + * Holds spam result values if there is spam reports agains it |
| 176 | + */ |
| 177 | + result?.spam // -> @optional AAReportResult |
| 178 | + |
| 179 | + /* |
| 180 | + * Holds scam result values if there is scam reports agains it |
| 181 | + */ |
| 182 | + result?.scam // -> @optional AAReportResult |
| 183 | +} |
| 184 | +``` |
| 185 | +Please refer to [EmailHealthResult](https://github.com/antideo/xcode/blob/master/Antideo/EmailHealthResult.h) class for full and up-to-date property list. |
| 186 | + |
| 187 | +See also: |
| 188 | +[AAReportResult](https://github.com/antideo/xcode/blob/master/Antideo/AAReportResult.h) |
| 189 | + |
| 190 | +## Available helper methods |
| 191 | + |
| 192 | +### Validate email string |
| 193 | +``` swift |
| 194 | +AAHelper. isValidEmail( "[email protected]") // true |
| 195 | +``` |
| 196 | + |
| 197 | +### Validate IP address |
| 198 | +``` swift |
| 199 | +// validates either ipv4 or ipv6 addresses |
| 200 | +AAHelper.isValidIPAddress("1.2.3.4") // true |
| 201 | + |
| 202 | +//validates only ipv4 addresses |
| 203 | +AAHelper.isValidIPV4Address("1.2.3.4") // true |
| 204 | + |
| 205 | +// validates only ipv6 addresses |
| 206 | +AAHelper.isValidIPV6Address("1.2.3.4") // false |
| 207 | +``` |
0 commit comments