All Projects → Ephenodrom → Dart Basic Utils

Ephenodrom / Dart Basic Utils

Licence: mit
A dart package for many helper methods fitting common situations

Programming Languages

dart
5743 projects
basic
69 projects

Projects that are alternatives of or similar to Dart Basic Utils

Dnsbrute
a fast domain brute tool
Stars: ✭ 352 (+130.07%)
Mutual labels:  dns, domain
Dank Selfhosted
Automated solution for hosting email, web, DNS, XMPP, and ZNC on OpenBSD.
Stars: ✭ 800 (+422.88%)
Mutual labels:  email, dns
Js.org
Dedicated to JavaScript and its awesome community since 2015
Stars: ✭ 3,996 (+2511.76%)
Mutual labels:  dns, domain
Kind Of
Get the native JavaScript type of a value, fast. Used by superstruct, micromatch and many others!
Stars: ✭ 268 (+75.16%)
Mutual labels:  date, string
Fierce
A DNS reconnaissance tool for locating non-contiguous IP space.
Stars: ✭ 1,072 (+600.65%)
Mutual labels:  dns, domain
Kldns
快乐二级域名分发系统
Stars: ✭ 277 (+81.05%)
Mutual labels:  dns, domain
Teemo
A Domain Name & Email Address Collection Tool
Stars: ✭ 595 (+288.89%)
Mutual labels:  email, domain
utils.js
👷 🔧 zero dependencies vanilla JavaScript utils.
Stars: ✭ 14 (-90.85%)
Mutual labels:  string, date
Thedev.id
🎉 An identity for developers on the web.
Stars: ✭ 37 (-75.82%)
Mutual labels:  dns, domain
Bash Toolkit
Este proyecto esá destinado a ayudar a los sysadmin
Stars: ✭ 13 (-91.5%)
Mutual labels:  dns, domain
domainerator
Simple application written in Go that combines two wordlists and a list of TLDs to form domain names and check if they are already registered.
Stars: ✭ 26 (-83.01%)
Mutual labels:  dns, domain
Hosts Blocklists
Automatically updated, moderated and optimized lists for blocking ads, trackers, malware and other garbage
Stars: ✭ 1,749 (+1043.14%)
Mutual labels:  dns, domain
is-biz-mail-php
isBizMail tells you whether a given email address belongs to a free email account provider (gmail.com, yahoo.es, yandex.ru etc) or not.
Stars: ✭ 19 (-87.58%)
Mutual labels:  email, domain
Awesome Falsehood
😱 Falsehoods Programmers Believe in
Stars: ✭ 16,614 (+10758.82%)
Mutual labels:  date, email
checkdmarc
A parser for SPF and DMARC DNS records
Stars: ✭ 124 (-18.95%)
Mutual labels:  dns, email
Information collection handbook
Handbook of information collection for penetration testing and src
Stars: ✭ 447 (+192.16%)
Mutual labels:  dns, domain
sender policy flattener
Compact large SPF chains into flat blocks of IP addresses
Stars: ✭ 25 (-83.66%)
Mutual labels:  dns, email
email-checker
Provides email verification on the go.
Stars: ✭ 116 (-24.18%)
Mutual labels:  dns, email
Disposable Email Domains
a list of disposable and temporary email address domains
Stars: ✭ 873 (+470.59%)
Mutual labels:  email, domain
Domainfuzz
Domain name permutation engine for detecting typo squatting, phishing and corporate espionage
Stars: ✭ 74 (-51.63%)
Mutual labels:  dns, domain

Basic Utils

A dart package for many helper methods fitting different situations.

Table of Contents

  1. Preamble
  2. Install
  3. Import
  4. Util Classes
  5. Changelog
  6. Copyright and license

Preamble

As this package is written in pure Dart, it can be used on all platforms on which dart is currently running. This includes the use of frameworks like Flutter, Angular Dart and many more. This package can also be used for command line tools or rest services compiled with dart2native.

Note: Feel free to contribute by creating pull requests or file an issue for bugs, questions and feature requests.

Install

pubspec.yaml

Update pubspec.yaml and add the following line to your dependencies.

dependencies:
  basic_utils: ^2.7.1

Or use the nullsafety preview version.

dependencies:
  basic_utils: ^3.0.0-null-safety.1

Import

Import the package with :

import 'package:basic_utils/basic_utils.dart';

Util Classes

The package contains different classes. Each class contains methods that provide a solution for certain problems.

StringUtils

Helper class for String operations.

String defaultString(String? str, {String defaultStr = ''});
bool isNullOrEmpty(String? s);
bool isNotNullOrEmpty(String? s);
String camelCaseToUpperUnderscore(String s);
String camelCaseToLowerUnderscore(String s);
bool isLowerCase(String s);
bool isUpperCase(String s);
bool isAscii(String s);
String capitalize(String s, {bool allWords = false});
String reverse(String s);
int countChars(String s, String char, {bool caseSensitive = true});
bool isDigit(String s);
bool equalsIgnoreCase(String a, String b);
bool inList(String s, List<String> list, {bool ignoreCase = false});
bool isPalindrome(String s);
String hidePartial(String s, {int begin = 0, int end, String replace = "*"});
String addCharAtPosition(String s, String char, int position,{bool repeat = false});
List<String> chunk(String s, chunkSize);

DomainUtils

Helper class for operations on domain names.

bool isDomainName(String s);
bool isSubTld(String tld, String? subTld);
bool isSubDomain(String? s);
bool isSubDomainOf(String sub, String domain);
bool isCCTLD(String s);
bool isNGTLD(String s);
bool isTld(String s);
bool isGTLD(String s);
List<String> splitDomainName(String domainName);
Domain? getDomainFromUrl(String url);
Domain? parseDomain(String domainName);
List<String> splitSubdomainInDomains(String name);
String toIDN(String domain);
String fromIDN(String domain)

EmailUtils

Helper class for operations on email addresses.

bool isEmail(String s);
EmailAddress? parseEmailAddress(String s);

MathUtils

Helper class for simple math operations like calculating circular area or converting length units.

double calculateCircumference(double radius);
double calculateCircularArea(double radius);
double calculateCircleDiameter(double radius);
double calculateSquareArea(double a, {double? b});
double convertUnit(double value, LengthUnits sourceUnit, LengthUnits targetUnit);
double calculateMixingTemperature(double mA, double tA, double mB, double tB,{double? cA, double? cB});
num mean(List<num> l);
double round(double value, int decimals);

HttpUtils

Helper class for simple http operations like sending requests.

Future<Map<Response> getForFullResponse(String url, {Map<String, dynamic>? queryParameters, Map<String, String>? headers});
Future<Map<String, dynamic>> getForJson(String url, {Map<String, dynamic>? queryParameters, Map<String, String>? headers});
Future<String> getForString(String url, {Map<String, dynamic>? queryParameters, Map<String, String>? headers});
Future<Map<Response> postForFullResponse(String url, {String? body, Map<String, String>? queryParameters, Map<String, String>? headers});
Future<Map<String, dynamic>> postForJson(String url, {String? body, Map<String, String>? queryParameters, Map<String, String>? headers});
Future<String> postForString(String url, {String? body, Map<String, String>? queryParameters, Map<String, String>? headers});
Future<Response> putForFullResponse(String url, {String? body, Map<String, String>? queryParameters, Map<String, String>? headers});
Future<Map<String, dynamic>> putForJson(String url, {String? body, Map<String, String>? queryParameters, Map<String, String>? headers});
Future<String> putForString(String url, {String? body, Map<String, String>? queryParameters, Map<String, String>? headers});
Future<Response deleteForFullResponse(String url, {Map<String, String>? queryParameters, Map<String, String>? headers});
Future<Map<String, dynamic>> deleteForJson(String url, {Map<String, String>? queryParameters, Map<String, String>? headers});
Future<String> deleteForString(String url, {Map<String, String>? queryParameters, Map<String, String>? headers});
Map<String, dynamic>? getQueryParameterFromUrl(String url);
String addQueryParameterToUrl(String url, Map<String, dynamic>? queryParameters);

DnsUtils

Helper class for lookup resource records. Uses google dns resolver api.

Future<List<RRecord>?> lookupRecord(String name, RRecordType type,{bool dnssec = false, DnsApiProvider provider = DnsApiProvider.GOOGLE});
RRecordType intToRRecordType(int type);
int rRecordTypeToInt(RRecordType type);
Future<List<RRecord>?> reverseDns(String ip,{DnsApiProvider provider = DnsApiProvider.GOOGLE});
String? getReverseAddr(String ip);

SortUtils

Helper class for sorting lists. Implementation of different sorting algorithms.

List quickSort(List list);
List bubbleSort(List list);
List heapSort(List list);

ColorUtils

Helper class for color operations.

int hexToInt(String hex);
String intToHex(int i);
String shadeColor(String hex, int percent);
String fillUpHex(String hex);
bool isDark(String hex);
String contrastColor(String hex);
Map<String, int> basicColorsFromHex(String hex);
double calculateRelativeLuminance(int red, int green, int blue,{int decimals = 2});
List<String> swatchColor(String hex, {double percentage = 15, int amount = 5});
String invertColor(String color);

DateUtils

Helper class for date operations like converting textual datetime description.

DateTime stringToDateTime(String s, {DateTime time});
int getCalendarWeek(DateTime date);

X509Utils

Helper class for operations on x509 certificates, like generating csr and many more.

IMPORTANT: A lot of functions, like handling asymetric key pairs moved to the CryptoUtils class with version 2.6.0.

String formatKeyString(String key, String begin, String end,{int chunkSize = 64, String lineDelimiter = "\n"});
String generateRsaCsrPem(Map<String, String> attributes,RSAPrivateKey privateKey, RSAPublicKey publicKey);
String encodeASN1ObjectToPem(ASN1Object asn1Object, String begin, String end);
RSAPrivateKey privateKeyFromASN1Sequence(ASN1Sequence asnSequence);
ASN1Object encodeDN(Map<String, String> dn);
X509CertificateData x509CertificateFromPem(String pem);

IterableUtils

Helper class for operations on iterables

T randomItem<T>(Iterable<T> iterable);
bool isNullOrEmpty(Iterable? iterable);
bool isNotNullOrEmpty(Iterable? iterable);
List<List<T>> chunk<T>(List<T> list, int size);

CryptoUtils

Helper class for cryptographic operations. This is some kind of high level api for pointycastle and asn1lib.

String getSha1ThumbprintFromBytes(Uint8List bytes);
String getSha256ThumbprintFromBytes(Uint8List bytes);
String getMd5ThumbprintFromBytes(Uint8List bytes);
Uint8List rsaPublicKeyModulusToBytes(RSAPublicKey publicKey);
Uint8List rsaPublicKeyExponentToBytes(RSAPublicKey publicKey);
Uint8List rsaPrivateKeyToBytes(RSAPrivateKey privateKey);
AsymmetricKeyPair generateRSAKeyPair({int keySize = 2048});
AsymmetricKeyPair generateEcKeyPair({String curve = 'prime256v1'});
String encodeRSAPublicKeyToPem(RSAPublicKey publicKey);
String encodeRSAPrivateKeyToPem(RSAPrivateKey rsaPrivateKey);
RSAPrivateKey rsaPrivateKeyFromPem(String pem);
RSAPublicKey rsaPublicKeyFromPem(String pem);
RSAPrivateKey rsaPrivateKeyFromDERBytes(Uint8List bytes);
RSAPublicKey rsaPublicKeyFromDERBytes(Uint8List bytes);
Uint8List getBytesFromPEMString(String pem);
String encodeEcPrivateKeyToPem(ECPrivateKey ecPrivateKey);
String encodeEcPublicKeyToPem(ECPublicKey publicKey);
ECPublicKey ecPublicKeyFromPem(String pem);
ECPrivateKey ecPrivateKeyFromPem(String pem);
ECPrivateKey ecPrivateKeyFromDerBytes(Uint8List bytes);
ECPublicKey ecPublicKeyFromDerBytes(Uint8List bytes);
String rsaEncrypt(String message, RSAPublicKey publicKey);
String rsaDecrypt(String cipherMessage, RSAPrivateKey privateKey);
Uint8List rsaSign(RSAPrivateKey privateKey, Uint8List dataToSign, {String algorithmName = 'SHA-256/RSA'});
bool rsaVerify(RSAPublicKey publicKey, Uint8List signedData, Uint8List signature,{String algorithm = 'SHA-256/RSA'});
String encodeRSAPrivateKeyToPemPkcs1(RSAPrivateKey rsaPrivateKey);
String encodeRSAPublicKeyToPemPkcs1(RSAPublicKey rsaPublicKey);
RSAPublicKey rsaPublicKeyFromPemPkcs1(String pem);
RSAPrivateKey rsaPrivateKeyFromPemPkcs1(String pem);
RSAPublicKey rsaPublicKeyFromDERBytesPkcs1(Uint8List bytes);
RSAPrivateKey rsaPrivateKeyFromDERBytesPkcs1(Uint8List bytes);

Changelog

For a detailed changelog, see the CHANGELOG.md file

Copyright and license

MIT License

Copyright (c) 2020 Ephenodrom

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].