Exemplo n.º 1
0
        private async static Task MakeUpload(string Url, string ChannelName, bool Hell)
        {
            try
            {
                var infos = new SourceInfos
                {
                    image   = Url.Replace(":large", ""),
                    channel = ChannelName,
                    source  = await GetSource(Url),
                    hell    = Hell
                };

                var payload = JsonConvert.SerializeObject(infos);

                var httpContent = new StringContent(payload, Encoding.UTF8, "application/json");

                var result = await Globals.Asker.PostAsync("https://sauce.shaps.work/upload.php", httpContent);
            }
            catch (HttpRequestException e)
            {
                if (e.Message.Contains("429"))
                {
                    await Task.Delay(500);
                    await MakeUpload(Url, ChannelName, Hell);
                }
            }
        }
Exemplo n.º 2
0
        protected override bool ComputeEqualsByHashCodeParts(AbstractDataFlowAnalysisContext <TaintedDataAnalysisData, TaintedDataAnalysisContext, TaintedDataAnalysisResult, TaintedDataAbstractValue> obj)
        {
            var other = (TaintedDataAnalysisContext)obj;

            return(SourceInfos.GetHashCode() == other.SourceInfos.GetHashCode() &&
                   SanitizerInfos.GetHashCode() == other.SanitizerInfos.GetHashCode() &&
                   SinkInfos.GetHashCode() == other.SinkInfos.GetHashCode());
        }
Exemplo n.º 3
0
 public CounterSourceInfo GetSource(string cs)
 {
     if (SourceInfos.ContainsKey(cs))
     {
         return(SourceInfos[cs]);
     }
     lock (SourceInfos)
     {
         Reload();
         if (SourceInfos.ContainsKey(cs))
         {
             return(SourceInfos[cs]);
         }
         CreateNewCounterSourceInfo(cs);
         return(SourceInfos[cs]);
     }
 }
Exemplo n.º 4
0
 protected override void ComputeHashCodePartsSpecific(Action <int> addPart)
 {
     addPart(SourceInfos.GetHashCode());
     addPart(SanitizerInfos.GetHashCode());
     addPart(SinkInfos.GetHashCode());
 }
Exemplo n.º 5
0
        public SourceInfos GetSourceInfos(UInt32 aAddress)
        {
            var xResult = new SourceInfos();

            try
            {
                var xMethod = GetMethod(aAddress);
                if (xMethod != null)
                {
                    var xSymbols      = GetSymbols(xMethod);
                    var xAssemblyFile = mConnection.Get <AssemblyFile>(xMethod.AssemblyFileID);
                    var xSymbolReader = SymbolAccess.GetReaderForFile(xAssemblyFile.Pathname);
                    var xMethodSymbol = xSymbolReader.GetMethod(new SymbolToken(xMethod.MethodToken));

                    int xSeqCount       = xMethodSymbol.SequencePointCount;
                    var xCodeOffsets    = new int[xSeqCount];
                    var xCodeDocuments  = new ISymbolDocument[xSeqCount];
                    var xCodeLines      = new int[xSeqCount];
                    var xCodeColumns    = new int[xSeqCount];
                    var xCodeEndLines   = new int[xSeqCount];
                    var xCodeEndColumns = new int[xSeqCount];
                    xMethodSymbol.GetSequencePoints(xCodeOffsets, xCodeDocuments, xCodeLines, xCodeColumns, xCodeEndLines, xCodeEndColumns);
                    if (xSymbols.Length == 0 && xSeqCount > 0)
                    {
                        var xSourceInfo = new SourceInfo()
                        {
                            SourceFile = xCodeDocuments[0].URL,
                            Line       = xCodeLines[0],
                            LineEnd    = xCodeEndLines[0],
                            Column     = xCodeColumns[0],
                            ColumnEnd  = xCodeEndColumns[0],
                            MethodName = xMethod.LabelCall
                        };
                        xResult.Add(aAddress, xSourceInfo);
                    }
                    else
                    {
                        foreach (var xSymbol in xSymbols)
                        {
                            var xRow = mConnection.Query <Label>(new SQLinq <Label>().Where(i => i.Name == xSymbol.LabelName)).FirstOrDefault();
                            if (xRow != null)
                            {
                                UInt32 xAddress = (UInt32)xRow.Address;
                                // Each address could have mult labels, but this wont matter for SourceInfo, its not tied to label.
                                // So we just ignore duplicate addresses.
                                if (!xResult.ContainsKey(xAddress))
                                {
                                    int xIdx        = SourceInfo.GetIndexClosestSmallerMatch(xCodeOffsets, xSymbol.IlOffset);
                                    var xSourceInfo = new SourceInfo()
                                    {
                                        SourceFile = xCodeDocuments[xIdx].URL,
                                        Line       = xCodeLines[xIdx],
                                        LineEnd    = xCodeEndLines[xIdx],
                                        Column     = xCodeColumns[xIdx],
                                        ColumnEnd  = xCodeEndColumns[xIdx],
                                        MethodName = xMethod.LabelCall
                                    };
                                    xResult.Add(xAddress, xSourceInfo);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            return(xResult);
        }
Exemplo n.º 6
0
        private SourceInfos DoGetSourceInfos(uint aAddress)
        {
            var xResult = new SourceInfos();

            try
            {
                var xMethod = GetMethod(aAddress);

                if (xMethod != null)
                {
                    var xSymbols      = GetSymbols(xMethod);
                    var xAssemblyFile = mConnection.Get <AssemblyFile>(xMethod.AssemblyFileID);

                    var xSeqPoints = GetSequencePoints(xAssemblyFile.Pathname, xMethod.MethodToken).ToList();
                    int xSeqCount  = xSeqPoints.Count;

                    var xCodeOffsets      = new int[xSeqCount];
                    var xCodeDocuments    = new string[xSeqCount];
                    var xCodeStartLines   = new int[xSeqCount];
                    var xCodeStartColumns = new int[xSeqCount];
                    var xCodeEndLines     = new int[xSeqCount];
                    var xCodeEndColumns   = new int[xSeqCount];

                    for (int i = 0; i < xSeqPoints.Count; i++)
                    {
                        xCodeOffsets[i]      = xSeqPoints[i].Offset;
                        xCodeDocuments[i]    = xSeqPoints[i].Document;
                        xCodeStartLines[i]   = xSeqPoints[i].LineStart;
                        xCodeStartColumns[i] = xSeqPoints[i].ColStart;
                        xCodeEndLines[i]     = xSeqPoints[i].LineEnd;
                        xCodeEndColumns[i]   = xSeqPoints[i].ColEnd;
                    }

                    if (xSymbols.Length == 0 && xSeqCount > 0)
                    {
                        var xSourceInfo = new SourceInfo()
                        {
                            SourceFile  = xCodeDocuments[0],
                            LineStart   = xCodeStartLines[0],
                            LineEnd     = xCodeEndLines[0],
                            ColumnStart = xCodeStartColumns[0],
                            ColumnEnd   = xCodeEndColumns[0],
                            MethodName  = xMethod.LabelCall
                        };

                        xResult.Add(aAddress, xSourceInfo);
                    }
                    else
                    {
                        foreach (var xSymbol in xSymbols)
                        {
                            var xRow = mConnection.GetList <Label>(Predicates.Field <Label>(q => q.Name, Operator.Eq, xSymbol.LabelName)).FirstOrDefault();

                            if (xRow != null)
                            {
                                uint xAddress = (uint)xRow.Address;
                                // Each address could have mult labels, but this wont matter for SourceInfo, its not tied to label.
                                // So we just ignore duplicate addresses.
                                if (!xResult.ContainsKey(xAddress))
                                {
                                    int xIdx        = SourceInfo.GetIndexClosestSmallerMatch(xCodeOffsets, xSymbol.IlOffset);
                                    var xSourceInfo = new SourceInfo()
                                    {
                                        SourceFile  = xCodeDocuments[xIdx],
                                        LineStart   = xCodeStartLines[xIdx],
                                        LineEnd     = xCodeEndLines[xIdx],
                                        ColumnStart = xCodeStartColumns[xIdx],
                                        ColumnEnd   = xCodeEndColumns[xIdx],
                                        MethodName  = xMethod.LabelCall
                                    };
                                    xResult.Add(xAddress, xSourceInfo);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            return(xResult);
        }
Exemplo n.º 7
0
 protected override void ComputeHashCodePartsSpecific(ref RoslynHashCode hashCode)
 {
     hashCode.Add(SourceInfos.GetHashCode());
     hashCode.Add(SanitizerInfos.GetHashCode());
     hashCode.Add(SinkInfos.GetHashCode());
 }
Exemplo n.º 8
0
 protected override void ComputeHashCodePartsSpecific(ArrayBuilder <int> builder)
 {
     builder.Add(SourceInfos.GetHashCode());
     builder.Add(SanitizerInfos.GetHashCode());
     builder.Add(SinkInfos.GetHashCode());
 }