Honeycomb is a honeypot framework.
12982
def cli(ctx, home, iamroot, config, verbose):
    """"""
    _mkhome(home)
    setup_logging(home, verbose)

    logger.debug("Honeycomb v%s", __version__, extra={"version": __version__})
    logger.debug("running command %s (%s)", ctx.command.name, ctx.params,
                 extra={"command": ctx.command.name, "params": ctx.params})

    try:
        is_admin = os.getuid() == 0
    except AttributeError:
        is_admin = ctypes.windll.shell32.IsUserAnAdmin()

    if is_admin:
        if not iamroot:
            raise click.ClickException("Honeycomb should not run as a privileged user, if you are just "
                                       "trying to bind to a low port try running `setcap 'cap_net_bind_service=+ep' "
                                       "$(which honeycomb)` instead. If you insist, use --iamroot")
        logger.warn("running as root!")

    ctx.obj["HOME"] = home

    logger.debug("ctx: {}".format(ctx.obj))

    if config:
        return process_config(ctx, config)
779886
@Override
	public <T extends Endpoint> Strategy<T> create() {
		return new NanoSecRandomStrategy<T>(broker, preferLocal);
	}
34616
def explode(self):
        
        # first elements, after groups
        self.contacts.explode(self.contactgroups, self.notificationways)
        self.contactgroups.explode()

        self.hosts.explode(self.hostgroups, self.contactgroups)

        self.hostgroups.explode()

        self.services.explode(self.hosts, self.hostgroups, self.contactgroups,
                              self.servicegroups, self.servicedependencies)
        self.servicegroups.explode()

        self.timeperiods.explode()

        self.hostdependencies.explode(self.hostgroups)

        self.servicedependencies.explode(self.hostgroups)

        # Serviceescalations hostescalations will create new escalations
        self.serviceescalations.explode(self.escalations)
        self.hostescalations.explode(self.escalations)
        self.escalations.explode(self.hosts, self.hostgroups, self.contactgroups)

        # Now the architecture part
        self.realms.explode()
205386
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	private void initLayerType() {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			setLayerType(LAYER_TYPE_SOFTWARE, getPaint());
			LOGGER.trace("Initialized the layer type");
		}
	}
1323844
protected final ContentCryptoMaterial createContentCryptoMaterial(
        AmazonWebServiceRequest req) {
        if (req instanceof EncryptionMaterialsFactory) {
            // per request level encryption materials
            EncryptionMaterialsFactory f = (EncryptionMaterialsFactory)req;
            final EncryptionMaterials materials = f.getEncryptionMaterials();
            if (materials != null) {
                return buildContentCryptoMaterial(materials, req);
            }
        }
        if (req instanceof MaterialsDescriptionProvider) {
            // per request level material description
            MaterialsDescriptionProvider mdp = (MaterialsDescriptionProvider) req;
            Map<String,String> matdesc_req = mdp.getMaterialsDescription();
            ContentCryptoMaterial ccm = newContentCryptoMaterial(
                kekMaterialsProvider,
                matdesc_req,
                cryptoConfig.getCryptoProvider(), req);
            if (ccm != null)
                return ccm;
            if (matdesc_req != null) {
                // check to see if KMS is in use and if so we should fall thru
                // to the s3 client level encryption material
                EncryptionMaterials material =
                    kekMaterialsProvider.getEncryptionMaterials();
                if (!material.isKMSEnabled()) {
                    throw new SdkClientException(
                        "No material available from the encryption material provider for description "
                        + matdesc_req);
                }
            }
            // if there is no material description, fall thru to use
            // the per s3 client level encryption  materials
        }
        // per s3 client level encryption materials
        return newContentCryptoMaterial(this.kekMaterialsProvider,
                                        cryptoConfig.getCryptoProvider(), req);
    }
907581
function swarmHashBlock (data, totalLength) {
  var hash = new Keccak(256)
  var tmp = Buffer.alloc(8)
  tmp.writeUIntLE(totalLength, 0, 6)
  hash.update(tmp)
  hash.update(data)
  return Buffer.from(hash.digest('bin'), 'binary')
}
25396
async function mgf1(seed, len, hash = 'SHA-256'){
  const hashSize = params.hashes[hash].hashSize;
  const blockLen = Math.ceil(len/ hashSize);

  const t = new Uint8Array(blockLen*hashSize);

  for(let i = 0; i < blockLen; i++) {
    const c = i2osp(i, 4);
    const x = new Uint8Array(seed.length + 4);
    x.set(seed);
    x.set(c, seed.length);
    const y = await jschash.compute(x, hash);
    t.set(y, i * hashSize);
  }
  return t.slice(0, len);
}
849842
public static PartialMerkleTree buildFromLeaves(NetworkParameters params, byte[] includeBits, List<Sha256Hash> allLeafHashes) {
        // Calculate height of the tree.
        int height = 0;
        while (getTreeWidth(allLeafHashes.size(), height) > 1)
            height++;
        List<Boolean> bitList = new ArrayList<>();
        List<Sha256Hash> hashes = new ArrayList<>();
        traverseAndBuild(height, 0, allLeafHashes, includeBits, bitList, hashes);
        byte[] bits = new byte[(int)Math.ceil(bitList.size() / 8.0)];
        for (int i = 0; i < bitList.size(); i++)
            if (bitList.get(i))
                Utils.setBitLE(bits, i);
        return new PartialMerkleTree(params, bits, hashes, allLeafHashes.size());
    }
1036794
function initModule(forge) {

forge.cipher = forge.cipher || {};

// registered algorithms
forge.cipher.algorithms = forge.cipher.algorithms || {};

/**
 * Creates a cipher object that can be used to encrypt data using the given
 * algorithm and key. The algorithm may be provided as a string value for a
 * previously registered algorithm or it may be given as a cipher algorithm
 * API object.
 *
 * @param algorithm the algorithm to use, either a string or an algorithm API
 *          object.
 * @param key the key to use, as a binary-encoded string of bytes or a
 *          byte buffer.
 *
 * @return the cipher.
 */
forge.cipher.createCipher = function(algorithm, key) {
  var api = algorithm;
  if(typeof api === 'string') {
    api = forge.cipher.getAlgorithm(api);
    if(api) {
      api = api();
    }
  }
  if(!api) {
    throw new Error('Unsupported algorithm: ' + algorithm);
  }

  // assume block cipher
  return new forge.cipher.BlockCipher({
    algorithm: api,
    key: key,
    decrypt: false
  });
};

/**
 * Creates a decipher object that can be used to decrypt data using the given
 * algorithm and key. The algorithm may be provided as a string value for a
 * previously registered algorithm or it may be given as a cipher algorithm
 * API object.
 *
 * @param algorithm the algorithm to use, either a string or an algorithm API
 *          object.
 * @param key the key to use, as a binary-encoded string of bytes or a
 *          byte buffer.
 *
 * @return the cipher.
 */
forge.cipher.createDecipher = function(algorithm, key) {
  var api = algorithm;
  if(typeof api === 'string') {
    api = forge.cipher.getAlgorithm(api);
    if(api) {
      api = api();
    }
  }
  if(!api) {
    throw new Error('Unsupported algorithm: ' + algorithm);
  }

  // assume block cipher
  return new forge.cipher.BlockCipher({
    algorithm: api,
    key: key,
    decrypt: true
  });
};

/**
 * Registers an algorithm by name. If the name was already registered, the
 * algorithm API object will be overwritten.
 *
 * @param name the name of the algorithm.
 * @param algorithm the algorithm API object.
 */
forge.cipher.registerAlgorithm = function(name, algorithm) {
  name = name.toUpperCase();
  forge.cipher.algorithms[name] = algorithm;
};

/**
 * Gets a registered algorithm by name.
 *
 * @param name the name of the algorithm.
 *
 * @return the algorithm, if found, null if not.
 */
forge.cipher.getAlgorithm = function(name) {
  name = name.toUpperCase();
  if(name in forge.cipher.algorithms) {
    return forge.cipher.algorithms[name];
  }
  return null;
};

var BlockCipher = forge.cipher.BlockCipher = function(options) {
  this.algorithm = options.algorithm;
  this.mode = this.algorithm.mode;
  this.blockSize = this.mode.blockSize;
  this._finish = false;
  this._input = null;
  this.output = null;
  this._op = options.decrypt ? this.mode.decrypt : this.mode.encrypt;
  this._decrypt = options.decrypt;
  this.algorithm.initialize(options);
};

/**
 * Starts or restarts the encryption or decryption process, whichever
 * was previously configured.
 *
 * For non-GCM mode, the IV may be a binary-encoded string of bytes, an array
 * of bytes, a byte buffer, or an array of 32-bit integers. If the IV is in
 * bytes, then it must be Nb (16) bytes in length. If the IV is given in as
 * 32-bit integers, then it must be 4 integers long.
 *
 * Note: an IV is not required or used in ECB mode.
 *
 * For GCM-mode, the IV must be given as a binary-encoded string of bytes or
 * a byte buffer. The number of bytes should be 12 (96 bits) as recommended
 * by NIST SP-800-38D but another length may be given.
 *
 * @param options the options to use:
 *          iv the initialization vector to use as a binary-encoded string of
 *            bytes, null to reuse the last ciphered block from a previous
 *            update() (this "residue" method is for legacy support only).
 *          additionalData additional authentication data as a binary-encoded
 *            string of bytes, for 'GCM' mode, (default: none).
 *          tagLength desired length of authentication tag, in bits, for
 *            'GCM' mode (0-128, default: 128).
 *          tag the authentication tag to check if decrypting, as a
 *             binary-encoded string of bytes.
 *          output the output the buffer to write to, null to create one.
 */
BlockCipher.prototype.start = function(options) {
  options = options || {};
  var opts = {};
  for(var key in options) {
    opts[key] = options[key];
  }
  opts.decrypt = this._decrypt;
  this._finish = false;
  this._input = forge.util.createBuffer();
  this.output = options.output || forge.util.createBuffer();
  this.mode.start(opts);
};

/**
 * Updates the next block according to the cipher mode.
 *
 * @param input the buffer to read from.
 */
BlockCipher.prototype.update = function(input) {
  if(input) {
    // input given, so empty it into the input buffer
    this._input.putBuffer(input);
  }

  // do cipher operation until it needs more input and not finished
  while(!this._op.call(this.mode, this._input, this.output, this._finish) &&
    !this._finish) {}

  // free consumed memory from input buffer
  this._input.compact();
};

/**
 * Finishes encrypting or decrypting.
 *
 * @param pad a padding function to use in CBC mode, null for default,
 *          signature(blockSize, buffer, decrypt).
 *
 * @return true if successful, false on error.
 */
BlockCipher.prototype.finish = function(pad) {
  // backwards-compatibility w/deprecated padding API
  // Note: will overwrite padding functions even after another start() call
  if(pad && (this.mode.name === 'ECB' || this.mode.name === 'CBC')) {
    this.mode.pad = function(input) {
      return pad(this.blockSize, input, false);
    };
    this.mode.unpad = function(output) {
      return pad(this.blockSize, output, true);
    };
  }

  // build options for padding and afterFinish functions
  var options = {};
  options.decrypt = this._decrypt;

  // get # of bytes that won't fill a block
  options.overflow = this._input.length() % this.blockSize;

  if(!this._decrypt && this.mode.pad) {
    if(!this.mode.pad(this._input, options)) {
      return false;
    }
  }

  // do final update
  this._finish = true;
  this.update();

  if(this._decrypt && this.mode.unpad) {
    if(!this.mode.unpad(this.output, options)) {
      return false;
    }
  }

  if(this.mode.afterFinish) {
    if(!this.mode.afterFinish(this.output, options)) {
      return false;
    }
  }

  return true;
};


}
98787
function Fbbot(options)
{
  if (!(this instanceof Fbbot)) return new Fbbot(options);

  /**
   * Custom options per instance
   * @type {object}
   */
  this.options = merge(Fbbot.defaults, options || {});

  /**
   * Store credentials
   * @type {object}
   */
  this.credentials =
  {
    // keep simple naming for internal reference
    token : this.options.pageAccessToken || this.options.token,
    secret: this.options.verifyToken || this.options.secret
  };

  if (!this.credentials.token || !this.credentials.secret)
  {
    throw new Error('Both `token` (pageAccessToken) and `secret` (verifyToken) are required');
  }

  // compose apiUrl
  this.options.apiUrl += this.credentials.token;

  /**
   * expose logger
   * @type {object}
   */
  this.logger = options.logger || bole(options.name || 'fbbot');

  /**
   * middleware storage (per event)
   * @type {object}
   * @private
   */
  this._stack = {};

  /**
   * lock-in public methods
   * wrap `_handler` with agnostic to accommodate different http servers
   * @type {function}
   */
  this.requestHandler = agnostic(this._handler.bind(this));

  // attach lifecycle filters
  inMiddleware(this);
  outMiddleware(this);

  /**
   * create incoming traverse paths
   * @type {Traverse}
   * @private
   */
  this._incoming = new Traverse(inTraverse.steps, {
    entry     : middleware.entryPoint,
    middleware: inTraverse.middleware.bind(this),
    emitter   : inTraverse.emitter.bind(this),
    prefix    : inTraverse.prefix
  });
  // wrap linkParent method
  this._incoming.linkParent = inTraverse.linkParent.bind(null, this._incoming.linkParent);

  /**
   * create outgoing traverse paths
   * @type {Traverse}
   * @private
   */
  this._outgoing = new Traverse(outTraverse.steps, {
    middleware: outTraverse.middleware.bind(this),
    emitter   : outTraverse.emitter.bind(this),
    prefix    : outTraverse.prefix
  });
  // wrap linkParent method
  this._outgoing.linkParent = outTraverse.linkParent.bind(null, this._outgoing.linkParent);
}
1001633
public function honeypot($name)
    {
        $input = $this->input($name, array("name" => $name, "autocomplete" => "off"));
        $wrapperStyles = array(
            "height: 1px",
            "overflow: hidden",
            "padding:1px 0 0 1px",
            "position: absolute",
            "width: 1px",
            "z-index: -1"
        );

        return sprintf('<div class="validation" style="%s">%s</div>', implode("; ", $wrapperStyles), $input);
    }
194332
function (B, E, callback) {
            //var rng = new SeededRandom();
            var rng = new SecureRandom();
            var qs = B >> 1;
            this.e = parseInt(E, 16);
            var ee = new BigInteger(E, 16);
            var rsa = this;
            // These functions have non-descript names because they were originally for(;;) loops.
            // I don't know about cryptography to give them better names than loop1-4.
            var loop1 = function () {
                var loop4 = function () {
                    if (rsa.p.compareTo(rsa.q) <= 0) {
                        var t = rsa.p;
                        rsa.p = rsa.q;
                        rsa.q = t;
                    }
                    var p1 = rsa.p.subtract(BigInteger.ONE);
                    var q1 = rsa.q.subtract(BigInteger.ONE);
                    var phi = p1.multiply(q1);
                    if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {
                        rsa.n = rsa.p.multiply(rsa.q);
                        rsa.d = ee.modInverse(phi);
                        rsa.dmp1 = rsa.d.mod(p1);
                        rsa.dmq1 = rsa.d.mod(q1);
                        rsa.coeff = rsa.q.modInverse(rsa.p);
                        setTimeout(function () {
                            callback()
                        }, 0); // escape
                    } else {
                        setTimeout(loop1, 0);
                    }
                };
                var loop3 = function () {
                    rsa.q = nbi();
                    rsa.q.fromNumberAsync(qs, 1, rng, function () {
                        rsa.q.subtract(BigInteger.ONE).gcda(ee, function (r) {
                            if (r.compareTo(BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) {
                                setTimeout(loop4, 0);
                            } else {
                                setTimeout(loop3, 0);
                            }
                        });
                    });
                };
                var loop2 = function () {
                    rsa.p = nbi();
                    rsa.p.fromNumberAsync(B - qs, 1, rng, function () {
                        rsa.p.subtract(BigInteger.ONE).gcda(ee, function (r) {
                            if (r.compareTo(BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) {
                                setTimeout(loop3, 0);
                            } else {
                                setTimeout(loop2, 0);
                            }
                        });
                    });
                };
                setTimeout(loop2, 0);
            };
            setTimeout(loop1, 0);
        }
1364122
async def setHiveKey(self, path, value):
        '''  '''
        perm = ('hive:set',) + path
        self.user.allowed(perm)
        return await self.cell.hive.set(path, value)
163838
def create_session(self, server_host, server_port, honeypot_id):
        
        protocol = self.__class__.__name__.lower()
        session = BaitSession(protocol, server_host, server_port, honeypot_id)
        self.sessions[session.id] = session
        return session
629083
private void expandAndRehash() {
    final int[] newHashSet = new int[hashSet.length * 2];
    final int bucketMask = (newHashSet.length - 1);

    for (int j = 0; j < hashSet.length; j++) {
      final int state = hashSet[j];
      if (state > 0) {
        int slot = hash(state, stateLength(state)) & bucketMask;
        for (int i = 0; newHashSet[slot] > 0;) {
          slot = (slot + (++i)) & bucketMask;
        }
        newHashSet[slot] = state;
      }
    }
    this.hashSet = newHashSet;
  }
446373
public static BigInteger createRandomModulusForSecret(BigInteger secret)
    {
        Random random = new SecureRandom();

        return createRandomModulusForSecret(secret, random);
    }
651923
def middleware
      mw = Hash.new { |e, m| e[m] = [] }
      mw["development"].concat([::Rack::ShowExceptions, ::Rack::Lint])
      require 'hanami/assets/static'
      mw["development"].push(::Hanami::Assets::Static)
      mw
    end