예제 #1
0
    public void writeToVulnerableSink2(string file, TaintedStruct struct1)
    {
        FileStream   fos    = new FileStream(file, FileMode.CreateNew);
        StreamWriter writer = new StreamWriter(fos);

        writer.Write(struct1.getTainted());
        writer.Close();
    }
    public static void main(string[] args)
    {
        try {
            // first case
            TestCase_IOT_MemberTaint testCase = new TestCase_IOT_MemberTaint();
            TaintedStruct            struct1  = new TaintedStruct();
            struct1.m_tainted = testCase.getVulnerableSource(args[0]);
            testCase.writeToVulnerableSink1(struct1.m_tainted);

            // second case
            TaintedStruct struct2 = new TaintedStruct(testCase.getVulnerableSource(args[0]));
            testCase.writeToVulnerableSink2(struct2.getTainted());

            // third case
            TaintedStruct struct3 = new TaintedStruct();
            struct3.setTainted(testCase.getVulnerableSource(args[0]));
            testCase.writeToVulnerableSink3(struct3.getTainted());
        } catch (Exception e) {
            Console.Write(e.StackTrace);
        }
    }
예제 #3
0
    public static void main(string[] args)
    {
        try {
            string file = args[0];
            string key  = args[1];

            // first case
            TestCase_IOT_Lost_MemberTaint testCase = new TestCase_IOT_Lost_MemberTaint();
            TaintedStruct taintStruct = new TaintedStruct();
            taintStruct.m_tainted = testCase.getVulnerableSource(file);
            testCase.writeToUnknownSink1(key, taintStruct.m_tainted);

            // second case
            TaintedStruct struct2 = new TaintedStruct(testCase.getVulnerableSource(args[0]));
            testCase.writeToUnknownSink2(struct2.getTainted());

            // third case
            TaintedStruct struct3 = new TaintedStruct();
            struct3.setTainted(testCase.getVulnerableSource(args[0]));
            testCase.writeToUnknownSink3(key, struct3.getTainted());
        } catch (Exception e) {
            Console.Write(e.StackTrace);
        }
    }