This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[32m2018-04-25T09:22:15[0m [[32mI[0m|[36mapp[0m|] Started POST "/api/v2/discovered_hosts/facts" for ::1 at 2018-04-25 09:22:15 +0300 | |
[32m2018-04-25T09:22:15[0m [[32mI[0m|[36mapp[0m|13a50] Processing by Api::V2::DiscoveredHostsController#facts as JSON | |
[32m2018-04-25T09:22:15[0m [[32mI[0m|[36mapp[0m|13a50] Parameters: {"facts"=>"[FILTERED]", "apiv"=>"v2", "discovered_host"=>{"facts"=>"[FILTERED]"}} | |
[32m2018-04-25T09:22:15[0m [[32mI[0m|[36mapp[0m|13a50] Current user: foreman_admin (administrator) | |
[32m2018-04-25T09:22:15[0m [D|[36mapp[0m|13a50] Setting current user thread-local variable to foreman_admin | |
[32m2018-04-25T09:22:15[0m [[32mI[0m|[36maud[0m|13a50] create event for Nic::Managed with id 44 | |
[32m2018-04-25T09:22:15[0m [D|[36mapp[0m|13a50] Setting current user thread-local variable to nil | |
[32m2018-04-25T09:22:15[0m [[33mW[0m|[36mapp[0m|13a50] Host discovery failed, facts: {"physicalprocessorcount"=>"3", "memorysize_mb"=>"900", "blockdevice.sda_size"=>"1234567890" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'socket' | |
def tcp_connect(address, port, timeout: 20) | |
# making sure we are talking with IP | |
connected = false | |
addr = Socket.getaddrinfo(address, nil) | |
sock_addr = Socket.pack_sockaddr_in(port, addr[0][3]) | |
Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0).tap do |socket| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('https://nominatim.openstreetmap.org/reverse?format=json&lat=32.0959358&lon=34.8215234&addressdetails=1&accept-language=en') | |
.then((data) => { return data.json() } ) | |
.then((data) => { console.table(JSON.stringify(data)) } ) | |
.catch((err) => { console.error(err) } ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net" | |
"strings" | |
"time" | |
) | |
const ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
use v5.20; | |
use IO::Socket::INET; | |
use experimental qw( switch ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
Example on how to do TCP port scanner in Python | |
''' | |
import socket | |
def scan(address, port, timeout=3): | |
'''TCP Port Scanner''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"hash" | |
"hash/adler32" | |
"hash/crc32" | |
"hash/fnv" | |
"github.com/dgryski/dgohash" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"path/filepath" | |
"time" | |
"github.com/go-audio/wav" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import ( | |
"bytes" | |
"io" | |
"io/ioutil" | |
"net/http" | |
) | |
// PeekReadCloser return a copy of a reader without loosing the original content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/sha512" | |
"fmt" | |
) | |
// CalcChecksum takes a slice of bytes and calculate it as a checksum | |
// it is using SHA512 for that (128 bytes for result) | |
func CalcChecksum(buff []byte) []byte { |