virtual

SSI注入漏洞

ぐ巨炮叔叔 提交于 2019-12-04 00:58:00
简介 SSI是英文Server Side Includes的缩写,翻译成中文就是服务器端包含的意思。从技术角度上说,SSI就是在HTML文件中,可以通过注释行调用的命令或指针。SSI具有强大的功能,只要使用一条简单的SSI命令就可以实现整个网站的内容更新,时间和日期的动态显示,以及执行shell和CGI脚本程序等复杂的功能。SSI可以称得上是那些资金短缺、时间紧张、工作量大的网站开发人员的最佳帮手。 (Server-side Includes)服务器端包含提供了一种对现有HTML文档增加动态内容的方法。apache和iis都可以通过配置支持SSI(默认Apache不开启SSI,SSI这种技术已经比较少用了),在网页内容被返回给用户之前,服务器会执行网页内容中的SSI标签。在很多场景中,用户输入的内容可以显示在页面中,比如一个存在反射XSS漏洞的页面,如果输入的payload不是xss代码而是ssi的标签,服务器又开启了ssi支持的话就会存在SSI漏洞。 环境配置 修改nginx.conf文件来启用SSI: ssi on; ssi_silent_errors off; ssi_types text/shtml;    SSI语法 显示服务器端环境变量<#echo> 1、获取本文档名称: <!–#echo var="DOCUMENT_NAME"–> 2、获取当前时间: <!–#echo

“As a rule of thumb, make all your methods virtual” in C++ - sound advice?

允我心安 提交于 2019-12-03 23:41:32
问题 I just happened upon the statement in the title. The full quote is: As a rule of thumb, make all your methods virtual (including the destructor, but not constructors) to avoid problems associated with omission of the virtual keyword. I found this in the Wrox book Professional C++ . You can google it to check. Is there anything to it? I would have thought that you'd only provide select extension points, not by-default extensibility. For instance, a 2001 article by Herb Sutter says so. Has

判断我们的服务器是物理机还是虚拟机

陌路散爱 提交于 2019-12-03 22:52:52
方法一:dmesg 举例如下: ###这是阿里云的云主机 [root@xxx ~]# dmesg |grep -i virtual [ 0.000000] Booting paravirtualized kernel on KVM [ 0.707486] KVM setup paravirtual spinlock [ 1.811087] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input2 [ 1.811257] input: VirtualPS/2 VMware VMMouse as /devices/platform/i8042/serio1/input/input3 [ 1.824106] systemd[1]: Detected virtualization kvm. [ 1.853583] systemd[1]: Starting Setup Virtual Console... ###这是一台物理机 [root@xxx]# dmesg |grep -i virtual Booting paravirtualized kernel on bare hardware input: Macintosh mouse button emulation as

undefined reference to `typeinfo for class' [duplicate]

余生长醉 提交于 2019-12-03 22:49:33
This question already has answers here : Closed 7 years ago . Possible Duplicate: g++ undefined reference to typeinfo Undefined symbols “vtable for …” and “typeinfo for…”? I can't use my class. class Accel { public: virtual void initialize(void); virtual void measure(void); virtual void calibrate(void); virtual const int getFlightData(byte); }; class Accel_ad : public Accel { public: Accel_ad() : Accel(){} void initialize(void) {/*code code code...*/} void measure(void) {/*measure code*/} const int getFlightData(byte axis){/*getting data*/} void calibrate(void) { int findZero[FINDZERO]; int

C++中虚函数实现原理揭秘

不羁岁月 提交于 2019-12-03 22:08:47
编译器到底做了什么实现的虚函数的晚绑定呢?我们来探个究竟。 编译器对每个包含虚函数的类创建一个表(称为V TA B L E)。在V TA B LE中,编译器放置特定类的虚函数地址。在每个带有虚函数的类 中,编译器秘密地置一指针,称为v p o i n t e r(缩写为V PT R),指向这个对象的V TA B L E。通过基类指针做虚函数调用时(也就是做多态调用时),编译器静态地插入取得这个V P TR,并在V TA B L E表中查找函数地址的代码,这样就能调用正确的函数使晚捆绑发生。为每个类设置V TA B L E、初始化V PTR、为虚函数调用插入代码,所有这些都是自动发生的,所以我们不必担心这些。利用虚函数,这个对象的合适的函数就能被调用,哪怕在编译器还不知道这个对象的特定类型的情况下。(《C++编程思想》) 在任何类中不存在显示的类型信息,可对象中必须存放类信息,否则类型不可能在运行时建立。那这个类信息是什么呢?我们来看下面几个类: class no_virtual { public: void fun1() const{} int fun2() const { return a; } private: int a; } class one_virtual { public: virtual void fun1() const{} int fun2() const {

Can we have a virtual static method ? (c++) [duplicate]

偶尔善良 提交于 2019-12-03 22:02:48
Possible Duplicate: C++ static virtual members? Can we have a virtual static method (in C++) ? I've tried to compile the following code : #include <iostream> using namespace std; class A { public: virtual static void f() {cout << "A's static method" << endl;} }; class B :public A { public: static void f() {cout << "B's static method" << endl;} }; int main() { /* some code */ return 0; } but the compiler says that : member 'f' cannot be declared both virtual and static so I guess the answer is no , but why ? thanks , Ron No. static on a function in a class means that the function doesn't need

CRTP to avoid virtual member function overhead

本小妞迷上赌 提交于 2019-12-03 21:11:08
In CRTP to avoid dynamic polymorphism , the following solution is proposed to avoid the overhead of virtual member functions and impose a specific interface: template <class Derived> struct base { void foo() { static_cast<Derived *>(this)->foo(); }; }; struct my_type : base<my_type> { void foo() {}; // required to compile. < Don't see why }; struct your_type : base<your_type> { void foo() {}; // required to compile. < Don't see why }; However it seems that the derived class does not require a definition to compile as it inherits one (the code compiles fine without defining a my_type::foo). In

Why must unused virtual functions be defined?

喜夏-厌秋 提交于 2019-12-03 20:59:32
问题 I find it quite odd that unused virtual functions must still be defined unlike unused ordinary functions. I understand somewhat about the implicit vtables and vpointers which are created when a class object is created - this somewhat answers the question (that the function must be defined so that the pointers to the virtual function can be defined) but this pushes my query back further still. Why would a vtable entry need to be created for a function if there's absolutely no chance that

Fake filesystem for Ruby

二次信任 提交于 2019-12-03 20:44:37
I'm in need of some code which fakes the actual file system to a fake one. So, when I start it it converts /home/user/Documents/fake_fs to / , so every Dir or File call goes to that directory. An example: I want to make a file on /some_file , so I use: File.open('/some_file', 'w') do |f| f.puts 'something on this file' end And it would write it on /home/user/Documents/fake_fs/some_file instead of /some_file . Is there any way of doing this? Thanks! You've got two options: Option 1 - Use a Gem to Fake it out FakeFS will do exactly what you want, with the caveat that some file system operations