Beispiel #1
0
        private void initVariable(string name, Value value)
        {
            var variable = new VariableName(name);

            EntryInput.FetchFromGlobal(variable);
            EntryInput.GetVariable(new VariableIdentifier(variable), true).WriteMemory(EntryInput.Snapshot, new MemoryEntry(value));
        }
 void ClearClicked(object sender, System.EventArgs e)
 {
     vc.Result        = "0";
     vc.Input         = "0";
     vc.prevOperation = null;
     EntryInput.Focus();
 }
        public async Task <Entry> Add(EntryInput entry)
        {
            var entity = mapper.MapEntry(entry, new EntryEntity());

            this.dbContext.Add(entity);
            await SaveChanges();

            return(mapper.MapEntry(entity, new Entry()));
        }
Beispiel #4
0
 public void Dispose()
 {
     PickedColor?.Dispose();
     EntryInput?.Dispose();
     SliderInput?.Dispose();
     SwitchInput?.Dispose();
     DatePickerInput?.Dispose();
     TimePickerInput?.Dispose();
     StepperInput?.Dispose();
     SubmitCommand?.Dispose();
     _submitDisposable?.Dispose();
 }
        public async Task <Entry> Update(Guid entryId, EntryInput entry)
        {
            var entity = await this.Entity(entryId);

            if (entity != null)
            {
                mapper.MapEntry(entry, entity);
                await SaveChanges();

                return(mapper.MapEntry(entity, new Entry()));
            }
            throw new KeyNotFoundException($"Cannot find entry {entryId.ToString()}");
        }
Beispiel #6
0
        /// <summary>
        /// Initialize php variables and control variables user by static analyser
        /// </summary>
        protected void GlobalsInitializer()
        {
            initTaintedArray("_POST");
            initTaintedArray("_GET");
            initTaintedArray("_SERVER");
            initTaintedArray("_COOKIE");
            initTaintedArray("_SESSION");
            initTaintedArray("_FILES");
            initTaintedArray("_REQUEST");
            initTaintedArray("GLOBALS");

            initVariable("_ENV", EntryInput.AnyArrayValue);
            initVariable("php_errormsg", EntryInput.AnyStringValue);
            initVariable("argc", EntryInput.AnyIntegerValue);
            initVariable("argv", EntryInput.AnyArrayValue);

            var staticVariablesArray = EntryInput.CreateArray();
            var staticVariable       = EntryInput.GetControlVariable(FunctionResolver.staticVariables);

            staticVariable.WriteMemory(EntryInput.Snapshot, new MemoryEntry(staticVariablesArray));

            var warnings         = new VariableName(".analysisWarning");
            var warningsVariable = EntryInput.GetControlVariable(warnings);

            warningsVariable.WriteMemory(EntryInput.Snapshot, new MemoryEntry(EntryInput.UndefinedValue));

            var securityWarnings         = new VariableName(".analysisSecurityWarning");
            var securityWarningsVariable = EntryInput.GetControlVariable(securityWarnings);

            securityWarningsVariable.WriteMemory(EntryInput.Snapshot, new MemoryEntry(EntryInput.UndefinedValue));

            //stack for catchblocks
            EntryInput.GetControlVariable(new VariableName(".catchBlocks")).WriteMemory(EntryInput.Snapshot, new MemoryEntry(EntryInput.CreateInfo(new TryBlockStack())));

            //array for global Constants
            var constantsVariable = EntryInput.GetControlVariable(UserDefinedConstantHandler.constantVariable);

            constantsVariable.WriteMemory(EntryInput.Snapshot, new MemoryEntry(EntryInput.CreateArray()));

            var staticVariableSink         = FunctionResolver.staticVariableSink;
            var staticVariableSinkVariable = EntryInput.GetControlVariable(staticVariableSink);

            staticVariableSinkVariable.WriteMemory(EntryInput.Snapshot, new MemoryEntry(EntryInput.UndefinedValue));

            EntryInput.GetControlVariable(FunctionResolver.evalDepth).WriteMemory(EntryInput.Snapshot, new MemoryEntry(EntryInput.CreateInt(0)));

            nativeObjectAnalyzer = NativeObjectAnalyzer.GetInstance(EntryInput);
        }
Beispiel #7
0
        private void initTaintedArray(string name)
        {
            // Get the variable
            var varName = new VariableName(name);

            EntryInput.FetchFromGlobal(varName);
            var variable = EntryInput.GetVariable(new VariableIdentifier(varName), true);

            // Create array and write it into the variable
            var array = EntryInput.CreateArray();

            array.SetInfo(new Flags(Flags.CreateDirtyFlags()));
            variable.WriteMemory(EntryInput.Snapshot, new MemoryEntry(array));

            // Create tainted any value
            var anyValue = EntryInput.AnyValue.SetInfo(new Flags(Flags.CreateDirtyFlags()));

            // Write tainted anyvalue to unknown field of the array (now stored in the variable)
            var entry = variable.ReadIndex(EntryInput.Snapshot, MemberIdentifier.getAnyMemberIdentifier());

            entry.WriteMemory(EntryInput.Snapshot, new MemoryEntry(anyValue));
        }
 void SqrtClicked(object sender, System.EventArgs e)
 {
     vc.PerformOperation(Operations.Sqrt);
     EntryInput.Focus();
 }
 void EqualClicked(object sender, System.EventArgs e)
 {
     vc.PerformOperation(vc.prevOperation);
     vc.prevOperation = null;
     EntryInput.Focus();
 }
 void MinusClicked(object sender, System.EventArgs e)
 {
     vc.PerformOperation(vc.prevOperation);
     vc.prevOperation = Operations.Subtract;
     EntryInput.Focus();
 }
 void ModuloClicked(object sender, System.EventArgs e)
 {
     vc.PerformOperation(vc.prevOperation);
     vc.prevOperation = Operations.Modulo;
     EntryInput.Focus();
 }
Beispiel #12
0
 public EntryEntity MapEntry(EntryInput src, EntryEntity dest)
 {
     return(mapper.Map(src, dest));
 }
Beispiel #13
0
 public async Task <Entry> Update(Guid entryId, [FromBody] EntryInput entry)
 {
     return(await repo.Update(entryId, entry));
 }
Beispiel #14
0
 public async Task <Entry> Add([FromBody] EntryInput entry)
 {
     return(await repo.Add(entry));
 }
        // POST /Api/v1/LogBooks/33/Entries
        public HttpResponseMessage Post([FromUri]int? logBookId, EntryInput entryInput)
        {
            var logBook = base.RavenSession.Load<LogBook>(logBookId);

            if (logBook == null)
                return NotFound();

            if (logBook.IsOwnedBy(base.User.Identity.Name) == false)
                return Forbidden();

            var entry = new Entry();
            entryInput.MapToInstance(entry);
            logBook.AddEntry(entry);

            base.RavenSession.Store(logBook);

            var entryView = entry.MapTo<LogBookView.EntryView>();

            return Created(entryView);
        }
        // PUT /Api/v1/LogBooks/33/Entries/1
        public HttpResponseMessage Put([FromUri]int? logBookId, [FromUri]int? entryId, EntryInput entryInput)
        {
            var logBook = base.RavenSession.Load<LogBook>(logBookId);

            if (logBook == null)
                return NotFound();

            if (logBook.IsOwnedBy(base.User.Identity.Name) == false)
                return Forbidden();

            var entry = logBook.GetEntries()
                               .SingleOrDefault(x=> x.Id == entryId);

            if (entry == null)
                return NotFound();

            entryInput.MapToInstance(entry);

            var entryView = entry.MapTo<LogBookView.EntryView>();

            return Created(entryView);
        }