text:
package org.projectfloodlight.openflow.protocol.ver14;

import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.common.hash.PrimitiveSink;
import com.google.common.hash.Funnel;

class OFBsnDebugCounterStatsEntryVer14 implements OFBsnDebugCounterStatsEntry {
    private static final Logger logger = LoggerFactory.getLogger(OFBsnDebugCounterStatsEntryVer14.class);
    // version: 1.4
    final static byte WIRE_VERSION = 5;
    final static int LENGTH = 16;

        private final static U64 DEFAULT_COUNTER_ID = U64.ZERO;
        private final static U64 DEFAULT_VALUE = U64.ZERO;

    // OF message fields
    private final U64 counterId;
    private final U64 value;
//
    // Immutable default instance
    final static OFBsnDebugCounterStatsEntryVer14 DEFAULT = new OFBsnDebugCounterStatsEntryVer14(
        DEFAULT_COUNTER_ID, DEFAULT_VALUE
    );

    // package private constructor - used by readers, builders, and factory
    OFBsnDebugCounterStatsEntryVer14(U64 counterId, U64 value) {
        if(counterId == null) {
            throw new NullPointerException("OFBsnDebugCounterStatsEntryVer14: property counterId cannot be null");
        }
        if(value == null) {
            throw new NullPointerException("OFBsnDebugCounterStatsEntryVer14: property value cannot be null");
        }
        this.counterId = counterId;
        this.value = value;
    }

    // Accessors for OF message fields
    @Override
    public U64 getCounterId() {
        return counterId;
    }

    @Override
    public U64 getValue() {
        return value;
    }

    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_14;
    }

    public OFBsnDebugCounterStatsEntry.Builder createBuilder() {
        return new BuilderWithParent(this);
    }

    static class BuilderWithParent implements OFBsnDebugCounterStatsEntry.Builder {
        final OFBsnDebugCounterStatsEntryVer14 parentMessage;

        // OF message fields
        private boolean counterIdSet;
        private U64 counterId;
        private boolean valueSet;
        private U64 value;

        BuilderWithParent(OFBsnDebugCounterStatsEntryVer14 parentMessage) {
            this.parentMessage = parentMessage;
        }

    @Override
    public U64 getCounterId() {
        return counterId;
    }

    @Override
    public OFBsnDebugCounterStatsEntry.Builder setCounterId(U64 counterId) {
        this.counterId = counterId;
        this.counterIdSet = true;
        return this;
    }
    @Override
    public U64 getValue() {
        return value;
    }

    @Override
    public OFBsnDebugCounterStatsEntry.Builder setValue(U64 value) {
        this.value = value;
        this.valueSet = true;
        return this;
    }
    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_14;
    }

        @Override
        public OFBsnDebugCounterStatsEntry build() {
                U64 counterId = this.counterIdSet ? this.counterId : parentMessage.counterId;
                if(counterId == null)
                    throw new NullPointerException("Property counterId must not be null");
                U64 value = this.valueSet ? this.value : parentMessage.value;
                if(value == null)
                    throw new NullPointerException("Property value must not be null");

                //
                return new OFBsnDebugCounterStatsEntryVer14(
                    counterId,
                    value
                );
        }

    }

    static class Builder implements OFBsnDebugCounterStatsEntry.Builder {
        // OF message fields
        private boolean counterIdSet;
        private U64 counterId;
        private boolean valueSet;
        private U64 value;

    @Override
    public U64 getCounterId() {
        return counterId;
    }

    @Override
    public OFBsnDebugCounterStatsEntry.Builder setCounterId(U64 counterId) {
        this.counterId = counterId;
        this.counterIdSet = true;
        return this;
    }
    @Override
    public U64 getValue() {
        return value;
    }

    @Override
    public OFBsnDebugCounterStatsEntry.Builder setValue(U64 value) {
        this.value = value;
        this.valueSet = true;
        return this;
    }
    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_14;
    }

//
        @Override
        public OFBsnDebugCounterStatsEntry build() {
            U64 counterId = this.counterIdSet ? this.counterId : DEFAULT_COUNTER_ID;
            if(counterId == null)
                throw new NullPointerException("Property counterId must not be null");
            U64 value = this.valueSet ? this.value : DEFAULT_VALUE;
            if(value == null)
                throw new NullPointerException("Property value must not be null");

            return new OFBsnDebugCounterStatsEntryVer14(
                    counterId,
                    value
                );
        }

    }

    final static Reader READER = new Reader();
    static class Reader implements OFMessageReader<OFBsnDebugCounterStatsEntry> {
        @Override
        public OFBsnDebugCounterStatsEntry readFrom(ChannelBuffer bb) throws OFParseError {
            U64 counterId = U64.ofRaw(bb.readLong());
            U64 value = U64.ofRaw(bb.readLong());

            OFBsnDebugCounterStatsEntryVer14 bsnDebugCounterStatsEntryVer14 = new OFBsnDebugCounterStatsEntryVer14(
                    counterId,
                      value
                    );
            if(logger.isTraceEnabled())
                logger.trace("readFrom - read={}", bsnDebugCounterStatsEntryVer14);
            return bsnDebugCounterStatsEntryVer14;
        }
    }

    public void putTo(PrimitiveSink sink) {
        FUNNEL.funnel(this, sink);
    }

    final static OFBsnDebugCounterStatsEntryVer14Funnel FUNNEL = new OFBsnDebugCounterStatsEntryVer14Funnel();
    static class OFBsnDebugCounterStatsEntryVer14Funnel implements Funnel<OFBsnDebugCounterStatsEntryVer14> {
        private static final long serialVersionUID = 1L;
        @Override
        public void funnel(OFBsnDebugCounterStatsEntryVer14 message, PrimitiveSink sink) {
            message.counterId.putTo(sink);
            message.value.putTo(sink);
        }
    }

    public void writeTo(ChannelBuffer bb) {
        WRITER.write(bb, this);
    }

    final static Writer WRITER = new Writer();
    static class Writer implements OFMessageWriter<OFBsnDebugCounterStatsEntryVer14> {
        @Override
        public void write(ChannelBuffer bb, OFBsnDebugCounterStatsEntryVer14 message) {
            bb.writeLong(message.counterId.getValue());
            bb.writeLong(message.value.getValue());

        }
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder("OFBsnDebugCounterStatsEntryVer14(");
        b.append("counterId=").append(counterId);
        b.append(", ");
        b.append("value=").append(value);
        b.append(")");
        return b.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        OFBsnDebugCounterStatsEntryVer14 other = (OFBsnDebugCounterStatsEntryVer14) obj;

        if (counterId == null) {
            if (other.counterId != null)
                return false;
        } else if (!counterId.equals(other.counterId))
            return false;
        if (value == null) {
            if (other.value != null)
                return false;
        } else if (!value.equals(other.value))
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;

        result = prime * result + ((counterId == null) ? 0 : counterId.hashCode());
        result = prime * result + ((value == null) ? 0 : value.hashCode());
        return result;
    }

}


text:
<?php

namespace AppBundle\Entity;

use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\ExclusionPolicy;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ExclusionPolicy("all")
 * @ORM\Entity
 * @ORM\Table(name="fs_foodsaver")
 */
class User implements AdvancedUserInterface
{
    const ROLE_FOODSHARER = 0;
    const ROLE_FOODSAVER = 1;
    const ROLE_STORE_COORDINATOR = 2;
    const ROLE_AMBASSADOR = 3;
    const ROLE_ADMIN = 4;
    const ROLE_SUPER_ADMIN = 5;
    /**
     * @Groups({"ownUser", "profile", "userId"})
     * @Expose
     * @ORM\Column(type="integer", options={"unsigned":true})
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(type="boolean", nullable=false)
     */
    private $verified = false;
    /**
     * @ORM\Column(type="integer", name="rolle")
     */
    private $role = 0;

    /**
     * @Groups({"ownUser", "profile"})
     * @Expose
     * @ORM\Column(type="string", length=50, nullable=false)
     */
    private $photo = "";

    /**
     * @ORM\Column(type="string", length=120)
     */
    private $email;

    /**
     * @ORM\Column(type="string", name="passwd", length=32)
     */
    private $password;

    /**
     * @Groups({"ownUser", "profile"})
     * @Expose
     * @ORM\Column(type="string", length=120, name="`name`")
     */
    private $firstName = "";

    /**
     * @Groups({"ownUser"})
     * @Expose
     * @ORM\Column(type="string", length=120, name="nachname")
     */
    private $lastName = "";

    /**
     * @Expose
     * @Groups({"userProfileStore"})
     * @ORM\Column(type="string", length=30, name="telefon")
     */
    private $phone = "";

    /**
     * @Expose
     * @Groups({"userProfileStore"})
     * @ORM\Column(type="string", length=50, name="handy")
     */
    private $mobile = "";

    /**
     * @ORM\Column(type="boolean")
     */
    private $active = false;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $lastLogin;

    public function isAccountNonExpired()
    {
        return true;
    }

    public function isAccountNonLocked()
    {
        return true;
    }

    public function isCredentialsNonExpired()
    {
        return true;
    }

    public function isEnabled()
    {
        return $this->active;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set verified
     *
     * @param boolean $verified
     *
     * @return User
     */
    public function setVerified($verified)
    {
        $this->verified = $verified;

        return $this;
    }

    /**
     * Get verified
     *
     * @return boolean
     */
    public function getVerified()
    {
        return $this->verified;
    }

    /**
     * Set role
     *
     * @param integer $role
     *
     * @return User
     */
    public function setRole($role)
    {
        $this->role = $role;

        return $this;
    }

    /**
     * Get role
     *
     * @return integer
     */
    public function getRole()
    {
        return $this->role;
    }

    /** Get roles
     *
     * @return string[]
     */
    public function getRoles()
    {
        $roles = ['ROLE_FOODSHARER', 'ROLE_FOODSAVER', 'ROLE_STORE_COORDINATOR', 'ROLE_AMBASSADOR', 'ROLE_ADMIN', 'ROLE_SUPER_ADMIN'];
        return array('ROLE_USER', $roles[$this->role]);
    }

    /**
     * Set photo
     *
     * @param string $photo
     *
     * @return User
     */
    public function setPhoto($photo)
    {
        $this->photo = $photo;

        return $this;
    }

    /**
     * Get photo
     *
     * @return string
     */
    public function getPhoto()
    {
        return $this->photo;
    }

    /**
     * Set email
     *
     * @param string $email
     *
     * @return User
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Get salt that is used by foodsharing code since 2015
     */
    public function getSalt()
    {
        return strtolower($this->email);
    }

    public function getUsername()
    {
        return $this->email;
    }

    public function eraseCredentials()
    {

    }

    /**
     * Set firstName
     *
     * @param string $firstName
     *
     * @return User
     */
    public function setFirstName($firstName)
    {
        $this->firstName = $firstName;

        return $this;
    }

    /**
     * Get firstName
     *
     * @return string
     */
    public function getFirstName()
    {
        return $this->firstName;
    }

    /**
     * Set lastName
     *
     * @param string $lastName
     *
     * @return User
     */
    public function setLastName($lastName)
    {
        $this->lastName = $lastName;

        return $this;
    }

    /**
     * Get lastName
     *
     * @return string
     */
    public function getLastName()
    {
        return $this->lastName;
    }

    /**
     * Set phone
     *
     * @param string $phone
     *
     * @return User
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;

        return $this;
    }

    /**
     * Get phone
     *
     * @return string
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * Set mobile
     *
     * @param string $mobile
     *
     * @return User
     */
    public function setMobile($mobile)
    {
        $this->mobile = $mobile;

        return $this;
    }

    /**
     * Get mobile
     *
     * @return string
     */
    public function getMobile()
    {
        return $this->mobile;
    }

    /**
     * Set active
     *
     * @param boolean $active
     *
     * @return User
     */
    public function setActive($active)
    {
        $this->active = $active;

        return $this;
    }

    /**
     * Get active
     *
     * @return boolean
     */
    public function getActive()
    {
        return $this->active;
    }

    /**
     * Set lastLogin
     *
     * @param \DateTime $lastLogin
     *
     * @return User
     */
    public function setLastLogin($lastLogin)
    {
        $this->lastLogin = $lastLogin;

        return $this;
    }

    /**
     * Get lastLogin
     *
     * @return \DateTime
     */
    public function getLastLogin()
    {
        return $this->lastLogin;
    }

    /**
     * Set password
     *
     * @param string $password
     *
     * @return User
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }
}

redpajama_set_name: RedPajamaGithub


text:
class SystemSettingsController < ApplicationController
end


text:
.class Landroid/support/v17/leanback/app/OnboardingFragment$1;
.super Ljava/lang/Object;
.source "OnboardingFragment.java"

# interfaces
.implements Landroid/view/View$OnClickListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v17/leanback/app/OnboardingFragment;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Landroid/support/v17/leanback/app/OnboardingFragment;

# direct methods
.method constructor <init>(Landroid/support/v17/leanback/app/OnboardingFragment;)V
    .locals 0

    iput-object p1, p0, Landroid/support/v17/leanback/app/OnboardingFragment$1;->this$0:Landroid/support/v17/leanback/app/OnboardingFragment;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public onClick(Landroid/view/View;)V
    .locals 2

    iget-object v0, p0, Landroid/support/v17/leanback/app/OnboardingFragment$1;->this$0:Landroid/support/v17/leanback/app/OnboardingFragment;

    iget-boolean v0, v0, Landroid/support/v17/leanback/app/OnboardingFragment;->mLogoAnimationFinished:Z

    if-nez v0, :cond_0

    return-void

    :cond_0
    iget-object v0, p0, Landroid/support/v17/leanback/app/OnboardingFragment$1;->this$0:Landroid/support/v17/leanback/app/OnboardingFragment;

    iget v0, v0, Landroid/support/v17/leanback/app/OnboardingFragment;->mCurrentPageIndex:I

    iget-object v1, p0, Landroid/support/v17/leanback/app/OnboardingFragment$1;->this$0:Landroid/support/v17/leanback/app/OnboardingFragment;

    invoke-virtual {v1}, Landroid/support/v17/leanback/app/OnboardingFragment;->getPageCount()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    if-ne v0, v1, :cond_1

    iget-object v0, p0, Landroid/support/v17/leanback/app/OnboardingFragment$1;->this$0:Landroid/support/v17/leanback/app/OnboardingFragment;

    invoke-virtual {v0}, Landroid/support/v17/leanback/app/OnboardingFragment;->onFinishFragment()V

    :goto_0
    return-void

    :cond_1
    iget-object v0, p0, Landroid/support/v17/leanback/app/OnboardingFragment$1;->this$0:Landroid/support/v17/leanback/app/OnboardingFragment;

    invoke-virtual {v0}, Landroid/support/v17/leanback/app/OnboardingFragment;->moveToNextPage()V

    goto :goto_0
.end method


text:
package com.github.javaparser;

import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.ImportDeclaration;
import com.github.javaparser.ast.body.BodyDeclaration;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.ast.stmt.Statement;

/**
 * The start production for JavaParser.
 * Tells JavaParser what piece of Java code it can expect.
 * For example,
 * COMPILATION_UNIT indicates a complete Java file,
 * and CLASS_BODY would indicate the part of a class that is within { and }.
 * @see JavaParser#parse(ParseStart, Provider)
 */
@FunctionalInterface
public interface ParseStart<R> {
	ParseStart<CompilationUnit> COMPILATION_UNIT = ASTParser::CompilationUnit;
	ParseStart<BlockStmt> BLOCK = ASTParser::Block;
	ParseStart<Statement> STATEMENT = ASTParser::BlockStatement;
	ParseStart<ImportDeclaration> IMPORT_DECLARATION= ASTParser::ImportDeclaration;
	ParseStart<Expression> EXPRESSION = ASTParser::Expression;
	ParseStart<AnnotationExpr> ANNOTATION = ASTParser::Annotation;
	ParseStart<BodyDeclaration<?>> ANNOTATION_BODY = ASTParser::AnnotationBodyDeclaration;
	ParseStart<BodyDeclaration<?>> CLASS_BODY = p -> p.ClassOrInterfaceBodyDeclaration(false);
	ParseStart<BodyDeclaration<?>> INTERFACE_BODY = p -> p.ClassOrInterfaceBodyDeclaration(true);

	R parse(ASTParser parser) throws ParseException;
}


text:
class AddPositionToVariables < ActiveRecord::Migration
  def self.up
    add_column :az_variables, :position, :integer

    Authorization.current_user = AzUser.find_by_login('admin')
    vars = AzVariable.find(:all, :order => "az_struct_data_type_id")
    struct_id = -1
    position = 0
    vars.each do |var|
      puts var.id.to_s + " " + var.name
      if struct_id != var.az_struct_data_type_id
        struct_id = var.az_struct_data_type_id
        position = 0
      end

      var.position = position
      position += 1
      var.save

    end

  end

  def self.down
    remove_column :az_variables, :position
  end
end


text:
layout: post
title:  How Network Spoofer v1 worked
date:   2012-01-04 11:00:00 +0000
categories: blog
---

NOTE: This article is very old and describes how Network Spoofer used to work.
Network Spoofer v1 was based off the
["Upside-Down-Ternet"](http://www.ex-parrot.com/pete/upside-down-ternet.html)
by Pete Stevens.
Check out [Network Spoofer v2 on Github](https://github.com/w-shackleton/android-netspoof).

A few people have been asking how Network Spoofer actually works; hopefully
this explanation will allow people to understand its working and try out their
own spoofs.

## The download file

Firstly, the extra download file is a minimal version of a debian system –
having the same system on each device makes it easier to ensure the same will
happen on the same device.

When Network Spoofer is run, the file is loaded (mounted) on the phone to allow
the files to be accessed. This is where almost all of the bugs with Network
Spoofer not loading occur; for some reason some devices just won't load the
file. If you want to have a go at mounting the file on the phone, then
[this script](http://bazaar.launchpad.net/~w-shackleton/android-netspoof/trunk/view/head:/res/raw/config)
is used to actually load it, and the variables used are set by the application
itself before running the script.

One of the reasons this stage sometimes doesn't work is that Android's app2SD
(applications on the SD card) uses this same method to load SD card
applications, and this could be interfering on some phones.

## Running programs inside the debian system

For programs to function correctly on this new system, a few system folders
have to be mounted inside the new system – namely `/dev`, `/proc` and `/sys`.
This is also done in [the script](http://bazaar.launchpad.net/~w-shackleton/android-netspoof/trunk/view/head:/res/raw/config)
mentioned above.
The unix command `chroot` is used to actually run programs inside the new
debian system – it makes the program think it has a different 'root' (top)
folder.

## Setting the system up to run spoofs

Inside this new environment (where programs think they are actually running on
a debian computer), the script
[/usr/local/bin/spoof](http://bazaar.launchpad.net/~w-shackleton/android-netspoof/debimg-trunk/view/head:/debimg/usr/local/bin/spoof)
is run. This script uses the phone settings given by the Android app (as well
as some detected settings) to set up the phone, ready to start spoofing.
First, it starts arpspoof running in the background on the phone
([line 97](http://bazaar.launchpad.net/~w-shackleton/android-netspoof/debimg-trunk/view/head:/debimg/usr/local/bin/spoof#L97))
which basically gets all internet traffic going first through the phone. The
phone tells the victim computer that it is the router, and tells the router
that it is the victim – this is called a 'man in the middle' attack.

To change information on websites, data travelling on port 80 needs to be
redirected to something else (line 115) and then picked up by a proxy server
which is started on the phone (line 112). The proxy server can then change or
redirect whatever it wants to on the phone.

## Changing data on websites

There are a set of scripts in the /rewriters folder in the debian image. Each
one waits for URLs to be inputted (typed into it), then returns a new and
potentially modified URL. The easiest way to add a new spoof is to add a new
script (based off one of the others) along with a text file describing it (see
one of the others for an example).

A link is created to the script to be used (line 111), or if multiple spoofs
are used a script is created which chains the selected scripts together. There
is an option in the configuration for the proxy which tells it to use the
linked script to change URLs as they are asked for – this is the key feature of
the proxy.
If data on the webpage is changed, the script may download the HTML file,
change it and put it in the folder /var/www/images. This folder is visible on a
webserver which is run on the phone (see the
[image flip script](http://bazaar.launchpad.net/~w-shackleton/android-netspoof/debimg-trunk/view/head:/debimg/rewriters/flip.pl)
for an example)
The spoof is now running – the script then waits for an enter key press before
stopping. It then stops the arp spoof, shuts down the proxy and the webserver,
removes the port 80 redirect rule and finishes.

I hope this has explained the inner workings and will help people to expand the
project, fix issues on certain devices and create more spoofs. If you have a
feature that you've created / would like implementing, file a request /
question or add your own branch of the code on the launchpad code hosting page.